如何使用Jquery文件上传插件在HTTP请求期间获取500状态(How to get the 500 status during HTTP request using Jquery file upl

编程入门 行业动态 更新时间:2024-10-11 01:20:05
如何使用Jquery文件上传插件在HTTP请求期间获取500状态(How to get the 500 status during HTTP request using Jquery file upload plugin)

我需要有关如何触发500/404状态的帮助。 请帮助我们,如何使用jquery文件上传插件处理异常处理。

done : function(e, data) { alert(data.jqXHR.status); var errorCode = $.parseJSON(data.jqXHR.responseText).errorCode; alert("error:::"+errorCode); alert(`enter code here`"Status"+data.textStatus); }

I Need help on how to trigger 500/404 status. kindly help us, how to handle exception handling using jquery file upload plugin.

done : function(e, data) { alert(data.jqXHR.status); var errorCode = $.parseJSON(data.jqXHR.responseText).errorCode; alert("error:::"+errorCode); alert(`enter code here`"Status"+data.textStatus); }

最满意答案

完成是为了成功响应,您必须使用的错误失败

这是来自jQuery文档,但插件当然以相同的方式工作

var menuId = $("ul.nav").first().attr("id"); var request = $.ajax({ url: "script.php", type: "POST", data: {id : menuId}, dataType: "html" }); request.done(function(msg) { $("#log").html( msg ); }); request.fail(function(jqXHR, textStatus) { alert( "Request failed: " + textStatus ); });

done is for successful responses, for errors you must use fail

This is from the jQuery documentation but the plugin certainly works the same way

var menuId = $("ul.nav").first().attr("id"); var request = $.ajax({ url: "script.php", type: "POST", data: {id : menuId}, dataType: "html" }); request.done(function(msg) { $("#log").html( msg ); }); request.fail(function(jqXHR, textStatus) { alert( "Request failed: " + textStatus ); });

更多推荐

本文发布于:2023-07-19 06:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1174835.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   文件上传   插件   状态   HTTP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!