mui.init();
mui.plusReady(function()
{
document.getElementById('login').addEventListener('tap',function()
{
var UserName=document.getElementById("account").value;
var Userpassword= hex_md5(document .getElementById("password").value);
mui.ajax('http://XXXXX/Login.asmx/MgLogin',
{
data:"{'loginname':'"+UserName+"','password':'"+Userpassword+"','identifies':'123456','code':''}",
type:'POST',//HTTP請求類型
dataType:'json',//服務器返回json格式數(shù)據(jù)
timeout:10000,//超時時間設(shè)置為10秒;
headers:{'Content-Type':'application/json'},
success:function(data)
{
//服務器返回響應,根據(jù)響應結(jié)果,分析是否登錄成功;
var jsons=data.d;
var str=JSON.parse(jsons);
if(str["StatusCode"]=="200")
{
mui.alert("登陸成功");
}else
{
mui.alert("登陸失敗");
}
},
error:function(xhr,type,errorThrown)
{
//異常處理;
mui.alert(type);
console.log(type);
}
});
});
});