jQuery Ajax 404 Handling

前端 未结 6 775
感动是毒
感动是毒 2020-12-03 10:03

Im trying to access a 404 event which I can see coming back as 404 with firebug but the error function is not kicking in, With my below code I always get Error: success ?.

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-03 10:54

    What you can also do is use the $.ajaxError function, like so

    $("#message").ajaxError(function (event, request, settings) {
        $(this).show();
        $(this).append("
  • Error requesting page " + settings.url + "
  • "); });

提交回复
热议问题