The form is submitted for verification, but there is no response. Please ask the teacher for advice.
走过沙漠的骆驼
走过沙漠的骆驼 2021-09-23 06:46:27
0
2
889
这个是register.html处理
<script>
	$(function(){
		$("#register").on('click',function(){
			$.ajax({
				type:'post',
				url:"{:url('index/user/insert')}",
				data:$('#login').serialize(),
				dataType:'json',
				success:function(data){
                    alert('成功');

				}
			})
		})
	})
</script>
这个是User.php验证
	public function insert()
	{

	    if(Request::isAjax()){
			//使用模型来创建数据
			//获取用户通过表单提交过来的数据
			//data是变量用来获取数据,是一个数组
			$data = Request::except('password_confirm','post');
			if(UserModel::create($data)){
				return['status'=>1,'message'=>'恭喜,注册成功'];
			}else{
				return['status'=>0,'message'=>'注册失败,请检查'];
			}
		}else{
			$this->error("请求类型错误",'register');
		}


	}

走过沙漠的骆驼
走过沙漠的骆驼

reply all(1)
逆旅行人

url:"{:url('index/user/insert')}" Is this a problem? Check in the browser whether the respond and request of the page register.html are normal

  • reply 错误 jquery-3.6.0.js:10109 POST http://localhost/index.php/index/user/insert.html 500 (Internal Server Error)
    走过沙漠的骆驼 author 2021-09-24 22:09:54
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template