Ajax自己的 属性提示错误 error:function(){} $.post().error() .ajaxError()
来源:互联网 发布:广州天拓网络 编辑:程序博客网 时间:2024/06/06 02:13
1、属性提示错误 error:function(){}
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <script src="js/jquery-1.10.1.min.js"></script> <script src="docm.js"></script></head><body> <form> 用户名:<input type="text" name="user" id="user"> 邮件:<input type="text" name="email" id="email"> <input type="button" value="提交"> </form><div id="box"></div></body></html>
$(function(){ $('form input[type=button]').click(function(){ $.ajax({ type:'POST', url:'user.php',//写一个错误的地址 data:$('form').serialize(), success:function(response,status,xhr){ $('#box').html(response); } }); }); error:function(xhr,errorText,errorType) {//xhr:XMLHttpRequest对象 errorText:错误信息 erroType:(可选)捕获的异常对象 alert('错误');//自定义错误 alert(errorText + ':' + errorType); alert(xmr.status + ':' + xmr, statusText); } })
2、$.post()使用连缀.error()方法提示错误,连缀方法将被.fail()取代
$.post('test1.php').error(function (xhr, status, info) { alert(xhr.status + ':' +xhr.statusText); alert(status + ':' + info);});
3、$.post()使用全局.ajaxError()事件提示错误
$(document).ajaxError(function (event, xhr, settings, infoError) { alert(xhr.status + ':' +xhr.statusText); alert(settings+ ':' + info); alert(event.type); alert(settings.url); //for(var i in event){ //查找event、settings有哪些属性方法 // document.wirte(i+<br>); // }});
阅读全文
0 0
- Ajax自己的 属性提示错误 error:function(){} $.post().error() .ajaxError()
- Jquery的ajax请求失败:error:function(){}
- 一个包含error:function的ajax请求
- ubuntu错误提示 error: implicit declaration of function ‘kmalloc’
- 错误提示:Syntax error on token "function", delete this token
- 运行opencv程序后出现runtime error! R6025-pure virtual function call 错误提示的解决方法
- NS_Binding_Aborted error for ajax function
- AJAX请求状态码返回200却跳到error的function
- 关于“error: conflicting types for 'function'”编译错误的分析
- 关于”error conflicting types for function”编译错误的分析
- Spark SQL: Error in query: undefined function错误的解决方法
- jquery ajax error:function调试信息
- 【DRP】——错误提示:"Syntax error on token "function" , delete this token"
- 求解释: 错误提示:Syntax error on token "function", delete this token
- post方法导致报InterServer Error 500的错误
- Error -26601: Decompression function 错误解决
- simulink仿真错误:MATLAB Function Interface Error
- ajax提出post请求,请求正常执行,但是返回error错误
- web.xml is missing and <failOnMissingWebXml> is set to true
- 第十八周:[Leetcode]98. Validate Binary Search Tree
- PHP中imagecopyresampled参数详解
- HTML标签语义
- MongoDB数据库设计准则
- Ajax自己的 属性提示错误 error:function(){} $.post().error() .ajaxError()
- bootstap 3.x+springMVC 发生图标不出来,样式还有
- Windows Server 2008 R2安装IIS
- javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name解决
- 暑期C++03 之匿名对象
- H5微信聊天案例、html5+css3仿微信聊天界面对话框 微信红包-打赏-霸屏
- Neither user 10029 nor current process has android.permission.WRITE_MEDIA_STORAGE.
- 使用Kotlin开发Android应用
- 回溯法——旅行商(TSP)问题