submit form does not stop in jquery ajax call

前端 未结 6 1224
感动是毒
感动是毒 2020-11-29 12:29

I got following code :

$.ajax({
    type: \"POST\",
    async: false,              
    url: \"CheckIdExist\",
    data: param,
    success: function(result)         


        
6条回答
  •  情书的邮戳
    2020-11-29 12:57

    I had this problem also but solved it by changing the input type="submit" to type="button" and then just do your ajax request

       $("input#submitbutton")
        {
                              $.ajax(
                            {                         type: "POST",
                                 async: false,              
                                url: "CheckIdExist",
                                 data: param,
                                success: function(result) {
                                     if (result == true){
                                        //TODO: do you magic
                                     }                      
                                     else
                                      $("form").submit();           
                                 },
                                 error: function(error) {
                                    alert(error);
                                    return false;
                                }
                            });
        });
    

提交回复
热议问题