Using .send() in a form with MVC


#1

Hello,

I’m trying to take data from a form and pass it back to my controller using the .send() method, but cannot figure out how to get it to work. Does the URL need to be the “localhost” URL or can I do something similar as with @Url.Action and use the controller as the parameter? Or do I need to go a different route to get the data back to my controller?


#2

UPDATE

Figured out how to pass the data. You can use @URL.Action(“Action”) for the first parameter, but you also need to send the 3rd parameter(asFormData) as true for the data to make it to the controller.

Example:

form.send(’@Url.Action(“UpdateTable”)’, “POST”, true);