Checking Ajax POST request - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Checking Ajax POST request (/showthread.php?tid=21315) |
Checking Ajax POST request - El Forum - 08-06-2009 [eluser]HooJee[/eluser] Hi Guys If I am making a POST request via AJAX how can I check whether the POST request was made in CI ? Usually The following works for a page refresh form submittion but not for an ajax request since it requires the submittion button name: Code: if($this->input->post('addBtn')) { Checking Ajax POST request - El Forum - 08-06-2009 [eluser]umefarooq[/eluser] can you post javascript how you are posting your data to CI. Checking Ajax POST request - El Forum - 08-06-2009 [eluser]Krzemo[/eluser] You get Ajax post value exactly the same way as regular form. Firefox and Firebug may help debuging. Checking Ajax POST request - El Forum - 08-06-2009 [eluser]jdfwarrior[/eluser] [quote author="HooJee" date="1249579979"]Hi Guys If I am making a POST request via AJAX how can I check whether the POST request was made in CI ? Usually The following works for a page refresh form submittion but not for an ajax request since it requires the submittion button name: Code: if($this->input->post('addBtn')) { Not understanding the question. You want to be able to check and see if a CI based system made the post? Or are you trying to find out if the post to CI worked? If your using jQuery, I made a quick post one day about posting to CI using jQuery. See my sig. Checking Ajax POST request - El Forum - 08-06-2009 [eluser]Spicer[/eluser] I have used this solutions in the past. http://snipplr.com/view/1060/check-for-ajax-request/ There are a few different ways to do it, but from my understanding you want to do something like this. Code: if(isajax()) |