darksniperx Posted August 10, 2011 Share Posted August 10, 2011 my ajax function: function getGroupDataWithAjax(){ $(document).ready(function() { var data = $.ajax({ url: "groupData.php", async: false }).responseText; return data; }); } function in my controller: function getGroupData(){ $groupData = $this->HomeModel->returnGroups(); return $groupData; } what i would like to do, is to call groupData.php with ajax, and store in a variable for later use. Quote Link to comment Share on other sites More sharing options...
trq Posted August 10, 2011 Share Posted August 10, 2011 Is it possible to retrieve data from controller with ajax in php mvc? Yes, an Ajax request isn't really that different to any normal request. Quote Link to comment Share on other sites More sharing options...
darksniperx Posted August 11, 2011 Author Share Posted August 11, 2011 got it soved by returning a string of data in new controller. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.