Blogger Information
Blog 2
fans 0
comment 0
visits 1593
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
form表单的提交
单眼皮
Original
849 people have browsed it

<script>
   $(function( ){
       //监听loginbutton
       $("#loginbutton").on('click',function (){
           //ajax函数提交到后端,提交的是对象
           $.ajax({
               //提交类型
               type: 'POST',
               //提交到login控制器下的check方法
               url: "{:url('login/check' )}",
               //提交的数据并序列化
               data: $(".layui-form").serialize(),
               //提交的类型
               dataType: "json",
               //成功的回调,data是从后端返回的数据
               success:function(data) {
                   layer.msg('只想弱弱提示');
                   //0表示成功,1表示失败
                   if (data.status == 0) {
                       alert(1);
                  //     window.location.href = "{:url('index/index')}";
                   } else {
                       alert(2);
                   //    window.location.href = "{:url('login/index')}";
                   }
               }
           })
       })})
</script>

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post