Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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