In Prototype, this Ajax call posts its form to the server as a URL encoded string of name-value pairs, as you would find in a HTTP GET request:
function doajax()
{
var current_req = new Ajax.Request('/doajax', {
asynchronous:true,
evalScripts:true,
parameters: $('ajax_form').serialize(true)}
);
}
How would you do the same thing using jQuery?
Since the default
methodforAjax.Requestis POST, the equivalent$.post()call would look like this:If you don’t need/don’t care about the response, this will do:
Or, if you’re specifically fetching a script, then it’ll look like this, using
$.ajax():