jQuery Ajax - how to get response data in error

后端 未结 4 1080
抹茶落季
抹茶落季 2020-12-13 08:23

I have a simple web application. I\'ve created the server REST API so it will return a response with HTTP code and a JSON (or XML) object with more details: application code

4条回答
  •  孤街浪徒
    2020-12-13 09:06

    directly from the docs

    The jQuery XMLHttpRequest (jqXHR) object returned by $.ajax() as of jQuery 1.5 is a superset of the browser's native XMLHttpRequest object. For example, it contains responseText and responseXML properties, as well as a getResponseHeader()

    so use the jqXRH argument and get the responseText property off it.

    In the link above, look for the section entitled

    The jqXHR Object

提交回复
热议问题