I have a page from which I am trying to make an AJAX call, but it isn't working, and I'm stumped as to why. My call is:
$.ajax({
type: "GET",
url: "<relative URL>/index.php?action=x",
dataType: "JSON"
}).success(function(person) {
alert(person.name) //alerts naem
});
return false;
});
and the PHP is:
<?
if($_GET["action"] == "x"){
$person = array("name"=>"Jon Doe","Reputation"=>"Good");
header("Content-Type: application/json");
echo json_encode($person);
}
?>
I don't THINK the issue is a faulty URL, since it is a c/p of working calls. It seems to me (but I'm not sure) that it chooses to reuse the old 'action-values' from when the source page was loaded originally. For some reason it completely ignores my action-value…?
Any ideas?