如何在jQuery中返回404状态 [英] how to return 404 status in jquery

查看:213
本文介绍了如何在jQuery中返回404状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我调用load方法.在某些情况下,它所调用的页面不存在.在萤火虫中,我可以看到404状态已返回.如何在jQuery中访问此状态以便可以处理?

I call the load method. There are some occasions when the page it calls does not exist. In firebug I can see the 404 status is returned. How can I access this status in jQuery so I can handle it?

$("#section-main-wrapper").load(uri);

推荐答案

传入回调函数:

$("#section-main-wrapper").load(uri, null, function(response, status, xhr) {
    // Check status
});

这篇关于如何在jQuery中返回404状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆