<script type="text/javascript">
$(function(){
$('#register').on('click',function(){
) // Use ajax to submit user information
. },
error: function (data)
gt;
Background method:
public function insert()
{
if(Request::isAjax()){
$data = Request::except ('password_confirm','post');
if(UserModel::create($data))
{
return ['status'=>1,'message'=>'Registration successful '];
}
}
Just change the submit button on the page to button!
I also encountered this situation, and later found out that it was related to the browser. The Firefox I used at first didn’t work, but after switching to Google, it became ok
Change the submit button on the page to button
Database debugging is turned on, and app debugging is turned on. Go directly to the insert page to check the problem. Create a test controller and write a data array create.
Hello, I have the same problem. Ajax is not executed. I don’t know what’s going on?
There may be a problem with the requested data type
Check the console for specific ajax errors. You can also see specific errors in the thinkphp log.