ajax回调函数

1.例

$.ajax({

dataType: "json", //数据格式:JSON

url: url, //目标地址

data: {"":""},//即使无参数,也要写。 ******************

async:false,//异步执行,这个ajax执行完后才能执行其他的js

error:function(XMLHttpRequest, textStatus, errorThrown) {

alert(XMLHttpRequest.status);//返回200,url提交成功

alert(XMLHttpRequest.readyState);//返回 4,(完成)响应内容解析完成,可以在客户端调用了

**********status 和redyState 返回非200和4,则火狐浏览器调试查看。

alert(textStatus);// 如果错误,返回"timeout", "error","notmodified" 和"parsererror",我遇到的是parserror 解析json时错误,原因

没有继承json-default

},

success: function (data){

//data 是封装好的json,一个对象。data.result,result在后台java中必须get、set,才能在回调函数中调用。

if(data.result==1){ self.location="login_yzm.jsp";

//window.navigate("login_yzm.jsp"); }

}

});

******************

//data: {valimobile:valimobile,username:name,isreport:'0'},

相关推荐
针叶6 小时前
Google Play加固保护导致的崩溃
android·安全·google
执明wa8 小时前
Android Studio 项目目录结构全方位详解
android·ide·android studio
__Witheart__9 小时前
Android编译错误:Soong阶段因缺失res目录导致panic (Iwlan模块)
android
酿情师10 小时前
逆向exe文件:CRT 初始化流程详细分析
android·软件构建·逆向·re·crt‘
问心无愧051311 小时前
ctf show web入门71
android·前端·笔记
夜勤月12 小时前
AQS 与 ThreadPoolExecutor 深度拆解:JDK 高并发底层设计精髓
android·java·开发语言
Yeyu12 小时前
Android 卡顿诊断 SDK:从痛点出发的设计思考
android
上天_去_做颗惺星 EVE_BLUE13 小时前
Ubuntu Android 虚拟机安装使用教程
android·linux·测试工具·ubuntu·安卓
我命由我1234513 小时前
Android 开发问题:Could not find com.github.PicnicSupermarket:FingerPaintView:1.2.
android·github·android studio·安卓·android jetpack·android-studio·android runtime