I appear to be having some sort of odd jQuery AJAX issue. I'm trying to get PHP code to execute using the isset() function and jquery on page load. Here's my jQuery code (it's already nested inside a document.ready function, and the code immediately before it runs perfectly):
$.ajax({
url: url,
data: {test: "test"},
post: "POST"
}).done(function(data) {
if (!data.error) {
alert("Test");
}
});
The callback function on completion of the ajax request is running. And then here's my PHP code:
if (isset($_POST["test"])) {
echo "Test";
}
I don't understand why it's not echoing. It's probably something ridiculously simple that I'm overlooking, but I've spent about 45 minutes on this. Any help would be greatly appreciated.