title: How to extend formdata with Javascript and post it to the Controller
body: <p>How can I somehow extend the formdata in Javascript with a variable so this will be available in my controller POST action.</p>
  
  <p>So what i want to do is, add a variable update (which is a bool) and send this with my formdata to the controller.</p>
  
  <p>Here's the code of my .js file &amp; controller code</p>
  
  <pre><code>    bootbox.confirm("Are you sure you want to override this Quotation?", function (result) {
          if (result === null) {
             //do nothing
          } else if (result) {
             if (!$form[0].checkValidity()) {
                 return false;
             }
  
             var btn = $('#saveQuotationForm');
             btn.attr('onclick', '');
             btn.attr('class', 'glyphicon glyphicon-floppy-save');
             btn.text('Saving...');
  
             var formurl = $form.attr('action');
             var formdata = $form.serialize();
  
             console.log(formurl + " =formurl");
             console.log(formdata + " =formdata");
  
             //tricky part, i want to do something like this:
             //var update = new boolean(false);
             //formdata.append(update, true); --&gt; but this is obviously not the way to go :), anyone got idea's?**
  
             $.post(formurl, formdata, function (data) {
                  if (data &amp;&amp; data.State === 'success') {
                      btn.attr('class', 'glyphicon glyphicon-floppy-saved');
                      btn.text('Saved');
                      $('#placeholderAlert').append('&lt;div class="alert alert-success" role="alert"&gt;&lt;strong&gt;Saved&lt;/strong&gt; ' + data.Message + '&lt;/div&gt;');
                  } else {
                      btn.attr('class', 'glyphicon glyphicon-floppy-remove');
                      btn.text('Saving failed');
                  }
            });
         }
    });
  
  
  
  
      [HttpPost]
      [ValidateAntiForgeryToken]
      public JsonNetResult Products_Quotation_Save(vmProducts_Quotation_Save quotation)
      {
          quotation.DateCreated = DateTime.Now;
          QuotationCache.Instance.SaveQuotation(GetClientCode(HttpContext), GetUserName(HttpContext), quotation, MuseContext);
          return JsonNet(new { State = "success", Message = "Quotation '" + quotation.Name + "' has been saved with reference " + quotation.ShortCode + ". &lt;a href=" + Url.Action(RouteItemAction.ResaPlus_Quotations) + " class=\"alert-link\"&gt;Go to overview&lt;/a&gt;" });
      }
  </code></pre>
  
  <p><strong>EDIT:</strong>
  This is indeed a duplicate of another question, apologies for that. I fixed it by one of the answers provided here: <a href="https://stackoverflow.com/questions/10398783/jquery-form-serialize-and-other-parameters">jquery form.serialize and other parameters</a></p>
  
  <p>so I created a variable and added it with $.param, then in my controller I have access to that param.</p>
  
  <pre><code>var update = { 'update': true };
  var formurl = $form.attr('action');
  var formdata = $form.serialize() + '&amp;' + $.param(update);
  
  $.post(formurl, formdata, function (data) {
  
  });
  
  [HttpPost]
  [ValidateAntiForgeryToken]
  public JsonNetResult Products_Quotation_Save(vmProducts_Quotation_Save quotation, bool update)
  {
  }
  </code></pre>