84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
Ich habe alle Laui-Dateien importiert, aber die jS-Datei kann nicht geladen werden. Ich habe die Pfade überprüft und sie sind genau die gleichen wie bei Ihnen.
{username:$('#username').val(),pwd:$('#pwd').val(),verifycode:$('#verifycode').val()}
不不,应该这样,还要把单引号去掉
{'username':$('#username').val(),'pwd':$('#pwd').val(),'verifycode':$('#verifycode').val()}
试试这样应该可以
引用路径看着好像没有什么问题,但你源代码指定的类型错了:type="text/javescript" ,你可以看下是不是这个原因
我的本地路径D:\PHPTutorial\WWW\qiyu\public\static\plugins\layui
代码如下
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>登录</title>
<link type="text/css" href="__STATIC__/plugins/layui/css/layui.css" rel="stylesheet"/>
<script type="text/javescript" src="__STATIC__/plugins/layui/layui.js"></script>
</head>
<body style="background:#0ed8da">
<div style="position: absolute;left:50%;top:50%;width:500px;margin-left:-250px;margin-top:-200px">
<div style="background:#fdfdfd;padding: 20px;border-radius:4px;box-shadow: 5px 5px 20px #444444">
<div class="layui-form">
<div class="layui-form-item" style="color:grey">
<h1>后胎管理系统<h1>
</div>
<hr>
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" id='username' class="layui-input">
<label class="layui-form-label">密码</label>
<input type="password" id='password' class="layui-input">
<label class="layui-form-label">验证码</label>
<div class="layui-input-inline">
<input type="text" id='verifycode' class="layui-input">
<img id="code" src="{:captcha_src()}" onclick="this.src=this.src+'?'+Math.random()"/>
<button class="layui-btn" onclick="dologin()">登录</button>
<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});
if(verifycode==''){
layer.alert('请输入验证码',{icon:2});
$.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>
</body>
</html>
可以把代码和文件路径贴上来看看
{username:$('#username').val(),pwd:$('#pwd').val(),verifycode:$('#verifycode').val()}
不不,应该这样,还要把单引号去掉
{'username':$('#username').val(),'pwd':$('#pwd').val(),'verifycode':$('#verifycode').val()}
试试这样应该可以
引用路径看着好像没有什么问题,但你源代码指定的类型错了:type="text/javescript" ,你可以看下是不是这个原因
我的本地路径D:\PHPTutorial\WWW\qiyu\public\static\plugins\layui
代码如下
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>登录</title>
<link type="text/css" href="__STATIC__/plugins/layui/css/layui.css" rel="stylesheet"/>
<script type="text/javescript" src="__STATIC__/plugins/layui/layui.js"></script>
</head>
<body style="background:#0ed8da">
<div style="position: absolute;left:50%;top:50%;width:500px;margin-left:-250px;margin-top:-200px">
<div style="background:#fdfdfd;padding: 20px;border-radius:4px;box-shadow: 5px 5px 20px #444444">
<div class="layui-form">
<div class="layui-form-item" style="color:grey">
<h1>后胎管理系统<h1>
</div>
<hr>
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" id='username' class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码</label>
<div class="layui-input-block">
<input type="password" id='password' class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">验证码</label>
<div class="layui-input-inline">
<input type="text" id='verifycode' class="layui-input">
</div>
<img id="code" src="{:captcha_src()}" onclick="this.src=this.src+'?'+Math.random()"/>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" onclick="dologin()">登录</button>
</div>
</div>
</div>
</div>
</div>
<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>
</body>
</html>
可以把代码和文件路径贴上来看看