Sunday, 15 June 2014

asp.net mvc - How I can pass FormCollection object with $.ajax(...) -



asp.net mvc - How I can pass FormCollection object with $.ajax(...) -

i working c# mvc application , have 2 action method in controller:

[multiplebutton(name = "action", argument = "save")] public actionresult savebasicinformation(formcollection collection) {.....} [multiplebutton(name = "action", argument = "submit")] public actionresult submitrequest(formcollection collection) {....}

the above code working fine without ajax request. question how can pass "formcollection" in $.ajax(..) specific controller method.

var input = $(':input'); $.ajax({ url: '@url.action("savebasicinformation", "home")', type: 'post', cache: false, data: input, success: function (data) { alert("success"); }, error: function (result) { alert("error"); alert(result.responsetext); } });

here error message when utilize above ajax code:

the current request action 'savebasicinformatio'' on controller type homecontroller' ambiguous between next action methods: system.web.mvc.action result submitrrquest(system.web.formcollection)....

thank help...

the `[multiplebutton]' attribute custom attribute possibly answer? may causing problem ajax call. seek removing attributes.

ajax asp.net-mvc asp.net-mvc-4

No comments:

Post a Comment