Skip to content

Instantly share code, notes, and snippets.

@mpneuried
Created November 18, 2015 07:01
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mpneuried/065dad78d692fc28c641 to your computer and use it in GitHub Desktop.
jQuery: How to post with a json body
_data =
foo: 23
bar: 42
bazz: null
$.ajax
url: _path
type: "POST"
data: JSON.stringify( _data )
contentType: "application/json; charset=utf-8"
dataType: "json"
success: ( model ) =>
# todo
return
error: ->
# todo
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment