Welcome Guest, Not a member yet? Register   Sign In
How to set and access global variable through controller functions?
#2

Ajax is used to run a server sided script from a view (not from a function in a controller), and most times return information to the view and update the DOM without refreshing the page. You'll have to rely on Javascript to do that (that's the j in Ajax).

What you can do, is pass the page_id to the view (from your "view" function). Put the Ajax function in that view to run the "groups/anotherFunction" function. The view knows the page_id, so it can pass it (by get or post) to "anotherFunction".
Don't make "anotherFunction" load another view, but let it echo the information that you want to get in the original view.

There's lot of Ajax examples combined with CodeIgniter out there on the internet, e.g. on StackOverflow.
Reply


Messages In This Thread
RE: How to set and access global variable through controller functions? - by Wouter60 - 09-14-2019, 12:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB