How to add additional data in my JQUERY submit?

前端 未结 3 1557
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-15 14:26

In my razor view, I\'m using a Html.BeginForm. In it I have two elements where when I set clic, should submit the form but I need to add an additional string pa

3条回答
  •  再見小時候
    2021-01-15 14:51

    On your form sumbit try like this:

            $("form").submit(function(){
               $.ajax({     
                    type: 'POST',  
                    url: "/Quiz/Index",
                    dataType: "json",
                    data: $("form").serialize() + '¶meter=param1' ,   
                    success: function () { 
                        alert("Successful"); 
                    }
                    error: function(){
                        alert('error');
                    }
    
                }); 
            });
    

    Hope it helps.


    Edit

    Try like this in your jQuery function:

    $('form').append('¶m=a');
    

提交回复
热议问题