post-json-for-jquery

1.0.1 • Public • Published

jQuery.postJSON()

Description: Load JSON-encoded data from the server using a POST HTTP request.

jQuery.postJSON( url [, data ] [, success ] )

url
Type: String
A string containing the URL to which the request is sent.

data
Type: PlainObject or String
A plain object or string that is sent to the server with the request.

success
Type: Function( PlainObject data, String textStatus, jqXHR jqXHR )
A callback function that is executed if the request succeeds.

This is a shorthand Ajax function, which is equivalent to:

$.ajax({
  type: "POST",
  dataType: "json",
  url: url,
  data: data,
  success: success
});

It is very similar to $.getJSON with only diffrence that it is sending POST request. You can check documenation for $.getJSON [here].

Changelog

  • 1.00
    • postJSON now properly sets it's content type to JSON.

Package Sidebar

Install

npm i post-json-for-jquery

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • shoter