2021年5月4日星期二

Ajax call pass in extra data paramter with formcollection

I'm working with a save method that requires the use of a formcollection but am also needing to pass in an extra parameter with my ajax call but when I do that my formcollection does not work correctly, what am I doing wrong? Here is my sample code:

  public ActionResult SaveMethod(formcollection fc1, string name)      { ...//rest of code       }  

My ajax call

 $.ajax({              type: "POST",              data: {fc1 , name},              url: "Home/SaveMethod",              success: function (result) { success(result); }          });  

I understand that you can also serialize the name as part of the formcollection but I would prefer not to do that, unless there is a way to remove that 'name' key from the formcollection. any ideas?

https://stackoverflow.com/questions/67394287/ajax-call-pass-in-extra-data-paramter-with-formcollection May 05, 2021 at 10:07AM

没有评论:

发表评论