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. Link to comment https://forums.phpfreaks.com/topic/244447-is-it-possible-to-retrieve-data-from-controller-with-ajax-in-php-mvc/ 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. Link to comment https://forums.phpfreaks.com/topic/244447-is-it-possible-to-retrieve-data-from-controller-with-ajax-in-php-mvc/#findComment-1255611 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. Link to comment https://forums.phpfreaks.com/topic/244447-is-it-possible-to-retrieve-data-from-controller-with-ajax-in-php-mvc/#findComment-1255677 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.