jQuery: The Write Less, Do More JavaScript Library

Ajax/jQuery.post

From jQuery JavaScript Library

Jump to: navigation, search

« Back to Ajax

jQuery.post( url, [data][callback] )

Load a remote page using an HTTP POST request.
This is an easy way to send a simple POST request to a server without having to use the more complex $.ajax function. It allows a single callback function to be specified that will be executed when the request is complete (and only if the response has a successful response code). If you need to have both error and success callbacks, you may want to use $.ajax.
Arguments:

urlString
The URL of the page to load.
data (Optional)Map
Key/value pairs that will be sent to the server.
callback (Optional)Function
A function to be executed whenever the data is loaded successfully.
function (data, textStatus) {
  // data could be xmlDoc, jsonObj, html, text, etc...
  this; // the options for this ajax request
}

Examples:{{{1}}}
NameType