L2019-06-16 23:40:26
{username:$('#username').val(),pwd:$('#pwd').val(),verifycode:$('#verifycode').val()}
#不不,應該這樣,還要把單引號去掉
L2019-06-16 23:33:45
{'username':$('#username').val(),'pwd':$('#pwd').val(),'verifycode':$('#verifycode').val( )}
試試看這樣應該可以
A天罡星2019-06-15 11:49:34
我的本機路徑D:\PHPTutorial\WWW\qiyu\public\static\plugins\layui
程式碼如下
#
;>
<腳本類型="text/javescript" src="__STATIC__/plugins/layui/layui.js"></script>
</ head>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" onclick="dologin()">登入</button>
</div>
</div>
## </div>
</div>
</div>
# </div>
<script type="text/javascript">
<script type="text/javascript"> layui.use(['layer'],function(){ $=layui.juqery; layer=layui.layer; }); function dologin(){ var username=$.trim($('#username').val());# var pwd= $.trim($('#password').val()); var verifycode=$.trim($('#verifycode').val());# if (username==''){ layer.alert('請輸入使用者名稱',{icon:2}); return;## }
# if(pwd==''){
layer.alert('請輸入密碼',{icon:2});
return;
## }
if(verifycode==''){
layer.alert('請輸入驗證碼',{icon:2});
return;
}
$.post('/admin.php/admin/Account/dologin',{'username':username,'pwd':pwd,'verifycode':verifycode},function(res ){
if(res.code>0){
layer.alert(res.msg,{icon:2});
}else{
layer.msg(res.msg);
setTimeout(function(){window.location.href='/admin.php/admin/Home/index'},1000);
}
},'json');
}
#
</script>
#