title: Change form action and verb on button click using jQuery
body: <p>I have a form that has a main submit button that needs to use POST and a specific action, but I also have a couple of buttons that need to submit the form using GET and to different actions.</p>
  
  <p>The only way I could see to do this was to intercept the submit using a jQuery .click() event and passing the form vars using something like this:</p>
  
  <pre><code>$('#btnClick').click(function (event) {
  
      event.preventDefault;
  
      input = $(':input');
      window.location.href = '/action/?' + input;
  
      return false;    
  })
  </code></pre>
  
  <p>This makes a messy querystring and exposes some hidden fields that contain lengthy data. What is the best way of using jQuery to intercept form submission and resending using GET?</p>
  
  <p>Btw, I am targeting different MVC GET Controller Actions with a couple of buttons while the main button uses POST to the Controller Action of the current view.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Though I haven't tried it yet, Mike provided an idea I hadn't thought of. I could do something like:</p>
  
  <pre><code>$("form").attr("action", "/action");
  $("form").attr("method", "post");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>$("form").attr("action", "/action");
  $("form").attr("method", "get");
  </code></pre>
  
  <p>but the latter will still expose some vars that are messy, mainly hidden fields. Is there a way of excluding the hidden fields without manually manipulating the querystring?</p>