post-json-nicely

0.1.2 • Public • Published

a preferrable api for posting JSON using jquery

postJson ($, url, javascriptObject)

JSON.stringifies javascriptObject and posts it to url.

returns a promise

example usage

myRequest = postJson($'/json'{hi:'hey'})
myRequest.done(
    (data, ...) -> console.log 'server says:'data)
myRequest.fail(
    (jqXHR, textStatus, err) -> alert 'post req failed!'jqXHR)
myRequest.always(
    () -> console.log 'made a post req')

Readme

Keywords

Package Sidebar

Install

npm i post-json-nicely

Weekly Downloads

1

Version

0.1.2

License

MIT

Last publish

Collaborators

  • elsehow