0

如果 post 调用成功,我如何访问从服务器返回的原始 HTTP 状态文本。对于错误,.error方法中有选项 errorThrown。中是否有模拟参数.success

代码:

  $.post(UI.SelectionList.settings.leftReturnURL, {
      delegateId: $(this).data('id')
  }, function (data, text, xhr) {}).success(function() {
      console.log(arguments);
  });

控制台输出:

["", "success", Object] //Object is the jqXHR object, statusText inside is also "success" 
4

1 回答 1

6
$.ajax({
    url: "/",

    success: function(data, textStatus, jQXHR) {
        console.log(jQXHR.status, jQXHR.statusText);
        //200 "OK"
    }
});
于 2012-08-02T16:27:14.223 回答