Skip to content

Instantly share code, notes, and snippets.

@pasupulaphani
Last active January 3, 2016 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pasupulaphani/8402603 to your computer and use it in GitHub Desktop.
Save pasupulaphani/8402603 to your computer and use it in GitHub Desktop.
<form method="post" action="/posts">
<input type="hidden" name="_method" value="put">
<input type="text" name="title">
<textarea name="content"></textarea>
<input type="submit" value="Save">
</form>
function makePutReq( url ){
var xhr = new XMLHttpRequest();
xhr.open( 'PUT', url, false );
xhr.setRequestHeader( 'Content-Type', 'text/plain' );
xhr.send( null );
}
<%= link_to refresh_post_user_post_path(@user,@post), :method => :put%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment