Javascript
Handlers
success
Default success handler.
CALLBACK PARAMETERS
Parameter | Type | Description |
---|---|---|
context |
object | Context object containing the Ajax call options. |
html |
string | HTML data returned in the response. Not used in most cases. |
xml |
XML object | Response XML object. You can, for example, use $(xml).find('data someValue').text() to access someValue property under data. |
EXAMPLE
function(context, html, xml) { $('#target-div).html( html ); // sets the content of #target-div to the returned HTML content alert( $(xml).find('data result msg').text() ); // alerts with the success response message }
failure
Default failure handler.
CALLBACK PARAMETERS
Parameter | Type | Description |
---|---|---|
context |
object | Context object containing the Ajax call options. |
message |
string | The server generated error message, for platform originating errors, or the HTTP error description, for transport errors. |
xml |
XML object | Response XML object, available only for platform-originating error, null for transport errors. You can, for example, use $(xml).find('data result code').text() to access the response code, when the XML object is available. |
xhr |
XHR object | The XHR object allows access to the Ajax request details, such as status code, response content and more. |
EXAMPLE
function(context, message, xml, xhr) { // alerts with the failure response message and response code alert( message + ' (' + $(xml).find('data result code').text() + ')' ); }