the success callback function is passed the returned data, which will be an xml root element or a text string depending on the mime type of the response. as of jquery 1.5, the success callback function is also passed a “jqxhr” object (in jquery 1.4, it was passed the xmlhttprequest object). as of jquery 1.5, all of jquery’s ajax methods return a superset of the xmlhttprequest object.
the jqxhr.done() (for success), jqxhr.fail() (for error), and jqxhr.always() (for completion, whether success or error; added in jquery 1.6) methods take a function argument that is called when the request terminates. if the request is already complete, the callback is fired immediately. the jqxhr.success(), jqxhr.error(), and jqxhr.complete() callback methods are removed as of jquery 3.0. you can use jqxhr.done(), jqxhr.fail(), and jqxhr.always() instead.
this example fetches the requested html snippet and inserts it on the page. pages fetched with post are never cached, i am trying to send data from a form to a database. here is the form i am using: