title: Pass multiple parameters with different types using $.ajax to an MVC method
body: <p>I'm having some problems posting multiple parameters to my controller using AJAX.I want to pass model list and button name (string) to my controller.</p>
  
  <p>jQuery:</p>
  
  <pre><code>function PostForm(buttonname) {
  
      $.ajax({
          url: "/ControllerName/ViewName",
          type: "POST",
          dataType: "application/JSON",
          data: 
          JSON.stringify({ 
             listOfObjects = $('#form').serialize(),
             button : buttonname
          })
      });
  };
  </code></pre>
  
  <p>partial view:</p>
  
  <pre><code>&lt;input name="buttonname" value="Name" onClick="PostForm('Name')" /&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>[HttpPost]
  public ActionResult ViewName(List&lt;MyObject&gt; listOfObjects ,string button)
  {
  //Obj should now contain the list of objects and button name
  }
  </code></pre>
  
  <p>On click of button,i am getting the value of button name but count of listobjects is 0.</p>
  
  <p>How do I pass multiple params with different datatypes to the MVC method? </p>
  
  <p>Ideas and suggestions greatly appreciated !
  Thanks!</p>