mui.plusReady(function(){
mui.ajax({
url:SERVER_URL+'HomeAppServlet',
async: false,
data:{campusId:APPID},
dataType: 'json', //服务器返回json格式数据
type: 'get', //HTTP请求类型
timeout: 1000, //超时时间设置为10秒;
success: function(data) {
console.log(JSON.stringify(data));
},
error: function(xhr, type, errorThrown) {
//异常处理;
mui.toast(type);
}
});
console.log('test');
});
控制台:
test at html/test.html:30
[object Object] at html/test.html:23
1 个回复
Kwela
其实很简单,mui和jQuery是兼容的,你直接调用jQuery 的ajax就可以,然后设置async: false,