How do you get request body data in controller? |
[eluser]SpudNik[/eluser]
This is does not work: var data = {username:"someuser",password:"somepassword"} $.ajax({ url:url, type:"POST", data:data, contentType:"application/json", dataType:"json", success: function(data){ alert(data); } }); } This does: $.post(url,data); The difference between these two AJAX calls is that the first one sets the Content-Type header to "application/json" $.post on the other hand sets the Content-Type to: application/x-www-form-urlencoded See this answer: http://stackoverflow.com/questions/85691...st-request Im new to CI so I'm wondering where I can read about $this->request->body |
Messages In This Thread |
How do you get request body data in controller? - by El Forum - 02-18-2012, 03:05 PM
How do you get request body data in controller? - by El Forum - 02-18-2012, 04:46 PM
How do you get request body data in controller? - by El Forum - 02-18-2012, 07:16 PM
How do you get request body data in controller? - by El Forum - 02-18-2012, 08:56 PM
How do you get request body data in controller? - by El Forum - 02-19-2012, 01:05 PM
How do you get request body data in controller? - by El Forum - 02-19-2012, 01:16 PM
How do you get request body data in controller? - by El Forum - 02-19-2012, 04:15 PM
|