var data = {
"userName": loginInfo.account,
"password":loginInfo.password
};
$.ajax({
type: "post",
url: userURL,
async: true,
data: 'data='+JSON.stringify(data),
dataType: "json",
contentType:"application/x-www-form-urlencoded; charset=utf-8",
timeout: 1000,
beforeSend: function() {
plus.nativeUI.showWaiting("登录中...");
},
complete: function() {
plus.nativeUI.closeWaiting();
},
success: function(data) {
var vData = JSON.stringify(data);
console.log(vData);
// 根据返回的数据,判断是否登录成功
var result = eval("("+ vData + ")");
if(result['success'] == true){
// 操作成功
}else{
// 登录失败
return callback(result['msg']);
}
},
error: function(xhr, type, errorThrown) {
return callback(errorThrown);
}
});
ajax请求 json
最新推荐文章于 2023-10-20 23:35:27 发布