Home  >  Q&A  >  body text

js cannot be loaded

I imported all the layui files. The CSS works, but the jS file cannot be loaded. What's going on? I checked the paths and they are exactly the same as yours.

A天罡星A天罡星1978 days ago2078

reply all(5)I'll reply

  • L

    L2019-06-16 23:40:26

    {username:$('#username').val(),pwd:$('#pwd').val(),verifycode:$('#verifycode').val()}

    No, no, it should be like this, but also remove the single quotes

    reply
    0
  • L

    L2019-06-16 23:33:45

    {'username':$('#username').val(),'pwd':$('#pwd').val(),'verifycode':$('#verifycode').val( )}

    Try this, it should work


    reply
    0
  • 步履不停

    步履不停2019-06-15 12:41:17

    The reference path seems to have no problem, but the type specified by your source code is wrong: type="text/javescript", you can check to see if this is the reason

    reply
    0
  • A天罡星

    A天罡星2019-06-15 11:49:34

    我的本地路径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()">Login</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('Please enter username',{icon:2});

    return;

    }

    if(pwd==''){

    layer.alert('Please enter password',{icon:2});

    return;

    }

    if(verifycode==''){

    layer.alert('Please enter the verification code',{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>


    reply
    0
  • 步履不停

    步履不停2019-06-15 11:17:29

    You can post the code and file path to see

    reply
    0
  • Cancelreply