Form submission using jQuery ajax

后端 未结 4 1998
太阳男子
太阳男子 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:26

    You should provide your HTML too in your question, but as far as i can see, you have event in event callbacks with actually nothing to initiate the submit event. So basically you should consider something like this :

    $(document).ready(function(){
    
        $('#sortable li').click(function() {
            event.preventDefault();
            var formdata = $("#frmgallery").serialize();
            alert(formdata);
            $.ajax({
                type: "POST",
                url: "gallery.php",
                data: formdata,
                success: function(){alert('success');}
            });
        });
    
    });
    

提交回复
热议问题