Click here to Skip to main content
16,004,727 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi frnds,

ajax submit and Jquery Submit for form

What I have tried:

i am having doubt for this ....can any one share the Example code for Ajax submit and jquery sumbit in mvc..please share the correct code please ,please share ....
Posted
Updated 12-Apr-16 21:40pm
Comments
Sinisa Hajnal 13-Apr-16 2:37am    
Plenty of examples out there. Search for it.

1 solution

Hi
In MVC you can submit your form using JQuery in very simple way.

Just create the click event for your button on client side and use the JQuery code.
as following

JavaScript
var myData = {
              param1: $("#someElementId").val(),
              param2: $("#anotherElementId").val()
              // so on
             }  
$.ajax({
    url: controller url,
    type: 'POST',
    dataType: "json",
    contentType: 'application/json',
    data: JSON.stringify(myData)
});


If you want to write manged code in jquery you can use the following link.
How to Write managed Code in JQuery[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900