Getting AJAX response body for use in error callback

前端 未结 4 2113
鱼传尺愫
鱼传尺愫 2020-12-10 00:08

jQuery\'s AJAX error function has the following parameters:

error(XMLHttpRequest, textStatus, errorThrown)

What\'s the best cross-browser w

4条回答
  •  孤街浪徒
    2020-12-10 01:01

    As of jQuery 1.4.1 you should use:

    var json = JSON.parse(xhr.responseText);
    

    See http://api.jquery.com/jQuery.parseJSON/.

提交回复
热议问题