Monday, 15 March 2010

php - keep getting undefined request with ajax -



php - keep getting undefined request with ajax -

using ajax code:

$.ajaxsetup({ url: "last-id-test.php", type: "post", }); $.ajax({ data: {theinfo: 'forminfo'}, success: function(data) {alert(data)}, error: function (xmlhttprequest, textstatus, errorthrown){alert('error submitting request.')} });

and simple php of last-id-test.php:

$showme = $_get['theinfo'];

i error 'undefined index - theinfo'...

i cant see mistake?

as mentioned in comments , post methods result in info beingness passed in different global variables in php -- == $_get post == $_post

so in case seek in php:

$showme = $_post['theinfo'];

useful debugging

print_r($_get); // or $_post or $_cookie

more info on these global variables: http://www.php.net/manual/en/reserved.variables.php

php javascript ajax

No comments:

Post a Comment