码迷,mamicode.com
首页 > 其他好文 > 详细

loginserver 个人草稿

时间:2017-07-18 13:33:36      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:element   async   button   .ajax   tac   doc   open   name   -o   

<script>
(function($, doc) {
/*var contextpath = "http://192.168.0.102:8080/pwgtjq";*/
var contextpath = "http://localhost:8080/pwgtjq";
$.init({
statusBarBackground: ‘#f7f7f7‘
});
////$.plusReady
$.ready(function() {
/*alert("当前页面url:"+plus.webview.currentWebview().getURL());*/
var loginButton=document.getElementById("login");
alert(1);
loginButton.addEventListener(‘tap‘, function(event) {
var path=contextpath+"/Login.action";
var parameter="username="+document.getElementById("username").value;
parameter+="&password="+document.getElementById("password").value;
alert(document.getElementById("username").value);

/*alert(loginInfo);
app.login(loginInfo, function(err) {
if (err) {
plus.nativeUI.toast(err);
return;
}
toMain();
});*/
/*var urls="http://192.168.0.104:8080/pwzdha";
var loginInfo = {
username: document.getElementById("username"),
password: document.getElementById("password")
};
params=JSON.stringify(loginInfo);
console.log(‘params=‘+params);*/
mui.toast(path);
$.ajax({
url:path,
type:"post",
data:parameter,
async:false,
dataType:"text",
success:
function(data,textStatus,jqXHR){
var regx1=new RegExp("您的浏览器不支持框架!","g");
var regx2=new RegExp("用户名或密码有误","g");
if(regx1.test(data))
{
/*var path=contextpath+"/main_top.action";
mui.alert(path);*/
var url="main.html";
var id="menu";
var login=plus.webview.open(url,id,"","fade-in",1000);

/* console.log(webview);//输出mui字符串*/
}
else if(regx2.test(data))
{
mui.toast("用户名或密码错误...");
}
else
{
mui.toast("抱歉,系统维护中。");
}
},
error:
function(XMLHttpRequest,textStatus,errorThrown){
mui.toast("status:"+XMLHttpRequest.status);
}
});
});
/*$.trigger(loginButton,‘tap‘);*/

//
window.addEventListener(‘resize‘, function() {
oauthArea.style.display = document.body.clientHeight > 400 ? ‘block‘ : ‘none‘;
}, false);
//
var backButtonPress = 0;
$.back = function(event) {
backButtonPress++;
if (backButtonPress > 1) {
plus.runtime.quit();
} else {
plus.nativeUI.toast(‘再按一次退出应用‘);
}
setTimeout(function() {
backButtonPress = 0;
}, 1000);
return false;
};
});

}(mui, document));
</script>

 

 

 

 


<!--<script type="text/javascript">
$("#login").click(function(){

alert(1);
$.ajax({
url:path,
type:"post",
data:parameter,
async:false,
dataType:"text",
success:
function(data,textStatus,jqXHR){
var regx1=new RegExp("您的浏览器不支持框架!","g");
var regx2=new RegExp("用户名或密码有误","g");
if(regx1.test(data))
{
var url="../html/menu.html";
var id="menu";
var login=plus.webview.open(url,id,"","fade-in",1000);
}
else if(regx2.test(data))
{
mui.toast("用户名或密码错误...");
}
else
{
mui.toast("抱歉,系统维护中。");
}
},
error:
function(XMLHttpRequest,textStatus,errorThrown){
mui.toast("status:"+XMLHttpRequest.status);
}
});
});
</script>
-->


ServletActionContext.getResponse().setHeader("Access-Control-Allow-Origin", "*");

 

loginserver 个人草稿

标签:element   async   button   .ajax   tac   doc   open   name   -o   

原文地址:http://www.cnblogs.com/CRayFish07/p/7199599.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!