title: include HTTP method in Javascript redirect?
body: <p>In my layout, I have a devise sign in / sign out link, like so:</p>
  
  <pre><code>=if user_signed_in? then link_to "_", destroy_user_session_path, :method =&gt; :delete else link_to "_", new_user_session_path, :method =&gt; :get end
  </code></pre>
  
  <p>This uses the rails helpers to build up the link, and resolves to the following HTML:</p>
  
  <pre><code>&lt;a data-method="get" href="/users/sign_in"&gt;_&lt;/a&gt;
  </code></pre>
  
  <p>I'm converting all links to buttons, and have just passed in URLs to onClick functions to redirect the browser.  In this case, I don't think a simple redirect will do the trick, because I need to specify the HTTP method.  Is this the right way to do this, and if so, how do I tell Javascript about the HTTP method?</p>
  
  <p>Thank you</p>