Hello there.
I'm fidling around with adding an AJAX based search form for a product database, but I'm stuck already in the beginning steps. Basically I'm having problems with sending parameters with my AJAX request. The problem is either so simple that I dont see, or so intricate to Modx that I don't know it.
This is the bare bones of what is going on.
I got my page where the results are to be displayed. It also contains this bit of jquery:
window.onload = function(){
$.ajax({
url: "index.php?id=25&name=John",
cache: false
}).done(function( html ) {
$("#searchResults").append(html);
});
}
The "id=25" is the ID of the resource handling AJAX requests and the "name=John" is my hardcoded parameter for test purposes.
The resource with ID of 25 simply contains this snippet:
There's no template, no nothing for it. It's been published but is not "visible".
Now in the snippet, if I write this:
$output = "John";
return $output;
It returns properly and is displayed like it should on my page. But if I write this:
$output = $_GET["name"];
return $output;
Nothing comes out.
Firebug tells me that the GET does make it to the page, but if I do a
It returns a list of GET's that doesnt contain my get.
Is there some hidden trick I should be aware of as to how to get the GET's and POST's?