Form submission using jQuery ajax

后端 未结 4 1997
太阳男子
太阳男子 2021-01-23 19:59

Form is not submit using ajax.form submit on click li. Give me some solution

My js code is here

$(document).ready(function(){

$(\'#sortable li\').click(         


        
4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-23 20:27

    Have you tried return false at the end of your submit function?

        $("#frmgallery").submit(function(e) {
            e.preventDefault();
            var formdata = $(this).serialize();
            alert(formdata);
            $.ajax({
                type: "POST",
                url: "gallery.php",
                data: formdata,
                success: function(){alert('success');}
                error: function(){alert('error');}
            });
            return false;
        });
    $('#sortable li').click(function() {
    
         $("#frmgallery").submit();
    });
    

    Also post what you get from $.ajaxcall

提交回复
热议问题