0

I am working C# MVC application and I have 2 action method in a controller:

[MultipleButton(Name = "action", Argument = "Save")]
public ActionResult SaveBasicInformation(FormCollection collection)
{.....}

[MultipleButton(Name = "action", Argument = "Submit")]
public ActionResult SubmitRequest(FormCollection collection)
{....}

The above code is working fine without ajax request. Now my question is how i can to pass "FormCollection" in $.ajax(..) for 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 is the error message when i use the above ajax code:

The current request for action 'SaveBasicInformatio'' on controller type HomeController' 
is ambiguous between the following action methods: System.Web.MVC.Action Result 
SubmitRrquest(System.Web.formCollection)....

Thank you for your help...

Samar
  • 35
  • 1
  • 1
  • 10
  • Have you tried removing the `[MultipleButton]` attribute from your action methods? –  Jun 21 '14 at 06:51
  • Yes.. After removing it's working fine.. Thank you so much for your help. I removed this attribute on all buttons. – Samar Jun 21 '14 at 07:08

1 Answers1

0

The `[MultipleButton]' attribute is a custom attribute possibly from this SO answer? which may be causing the problem as its an ajax call. Try removing the attributes.

Community
  • 1
  • 1