使用jQuery .load()或.get()返回500错误消息

Jim*_*ket 3 jquery exception-handling httpwebrequest

我正在尝试使用jQuery .load()方法进行AJAX调用.请求通过后,它会正确加载返回数据.如果我得到500错误,则不会.有没有办法输出失败的请求消息信息?

$("#activity").load("/forumsetup", { id:myid }, 
       function(data) {
          $("#restart").css("visibility","visible");
        });  
Run Code Online (Sandbox Code Playgroud)

我可以在firebug中看到它,但想将它加载到我的页面上.

Alx*_*ndr 12

来自jQuery doc页面:http://api.jquery.com/load/

$("#success").load("/not-here.php", function(response, status, xhr) {
  if (status == "error") {
    var msg = "Sorry but there was an error: ";
    $("#error").html(msg + xhr.status + " " + xhr.statusText);
  }
});
Run Code Online (Sandbox Code Playgroud)