Monday, April 23, 2012

AJAX posting to CakePHP controller action

I am posting some form values used for registration into a cakePHP controller action. The code is like this



var params='firstname='+encodeURIComponent(firstname) +'&lastname='+encodeURIComponent(lastname)+'&emailid='+encodeURIComponent(emailid)+'&password='+encodeURIComponent(password);

xmlhttp.open('POST', url, true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(params);


this is doing the posting and I can see it in the Firebug in the POST section source as



firstname=name&lastname=name&emailid=mymailid&password=123123


But when I print $this->data in the action , it is not not showing any values. I have even used $_POST and it is also returning anything..



What I done wrong here..?





No comments:

Post a Comment