The code of checkLogin is copied, it should be correct, but I don’t know what went wrong, and there is no response when I click the submit button
public function checkLogin(Request $request)
{
//Initial return parameters
$status =0;
$result ='';
$data = $request -> param();
//Create validation rules
$rule=[
'name|Username'=>'require', //Username is required
'password|password'=>'require', //Password is required
'verify|Verification code'=>'require|captcha', //Username is required
];
//Customized verification failure prompt message
$msg=[
'name'=>['require'=>'User The name cannot be empty, please check'],
'password'=>['require'=>'The password cannot be empty, please check'],
'verify'= & gt; [
'request' = & gt; '' verification code cannot be empty, please check ',
##' captcha '= & gt; ], ]; //Verify //$result will only return two values: true-> indicates that the verification is passed. If a string is returned, It is a user-defined error prompt $result=$this->validate($data,$rule,$msg);
if($result===true){
//Construct query conditions
$map =[
];
## //Query user information
$user=UserModel::get($map);
if($user == null){
$result = 'The user was not found'; }else{
<div class="formControls col-xs-8 col-xs-offset-3">
<input name="" type="button" id="login" class= "btn btn-success radius size-L" value=" Login Record ">
</div>
<! -- Ajax submission script-->
<script>
$(function(){
//Add a click event to the login button
$("#login").on('click',function(event){
$.ajax({
type:"POST".//The submission method is post
url:"{:url('checkLogin')}",//Set the address of the script file for submitting data processing
data:$("form").serialize(),/ /Serialize the data of the current form and submit it
dataType:'json',//Set the type of submitted data to json
success: function(data){ //Only the flag bit is 1 before processing
if(data.status==1){
alert(data.message);
window.location.href="{:url ('index/index')}";
}else{
alert(data.message);
}
}
});
})
})
</script>
##
Solved, the punctuation was wrong and it was written as.