jQuery documentation indicates the following is returned:
success(data, textStatus,
XMLHttpRequest)FunctionA function to be called if the request
succeeds. The function gets passed
three arguments: The data returned
from the server, formatted according
to the ‘dataType’ parameter; a string
describing the status; and the
XMLHttpRequest object. This is an Ajax
Event.
I have only been using the "data" parameter.
What is the purpose of the "textStatus"?…I get "undefined" when I put this var in an alert (within the success function)
What can I get from the XMLHttpRequest? and how do I access it?
Thanks
You could use the
XMLHttpRequestobject to get any response headers the server sent. This is of limited usefulness for services you control as it’s usually better to pass back all information in the JSON or XML of the response body, but it could be useful for talking to services whose interfaces you don’t have control over, that put useful information in the headers.The
textStatuscan be of use for an error-callback to tell you how far the request got. But for success it would only tell you whether the server returned a200 OKresponse (in which case you should get'success') or whether you got a304 Not Modifiedand the body returned from browser cache instead (in which case it should be'notmodified'. This is highly unlikely to be useful.