search

Home  >  Q&A  >  body text

Why does my ajax keep calling error! ! ! ! !

<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 '];

                                                                       return ['message'=>'Operation failed',''status'=> >error('Request type error','register');

}
}

阿荣阿荣2357 days ago1425

reply all(8)I'll reply

  • 一粒红尘

    一粒红尘2018-09-08 22:24:32

    Just change the submit button on the page to button!

    reply
    1
  • 张**

    张**2018-08-17 08:04:06

    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

    reply
    0
  • 张**

    md suddenly stopped working again, and even changing the browser didn't work.

    张** · 2018-08-17 08:21:24
  • SuperTizzy

    SuperTizzy2018-06-27 16:43:17

    Change the submit button on the page to button

    reply
    2
  • phpcn_u228560

    phpcn_u2285602018-06-23 13:59:09

    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.

    reply
    0
  •  Jensen

    Jensen 2018-06-20 10:20:43

    Hello, I have the same problem. Ajax is not executed. I don’t know what’s going on?

    reply
    0
  • Summer

    Summer2018-06-15 16:06:09

    There may be a problem with the requested data type

    reply
    0
  • 无忌哥哥

    无忌哥哥2018-06-14 10:55:36

    Check the console for specific ajax errors. You can also see specific errors in the thinkphp log.

    reply
    0
  • Cancelreply