Class: json

Suit.request. json

new Suit.request.json()

Reference to the shortcuts for creating requests that expects Json as result.

Methods

staticSuit.request.json.get(p_url, p_callback, p_data, p_headers){XmlHttpRequest}

Creates a GET request expecting 'json' response.

Name Type Description
p_url String

URL

p_callback RequestCallback

Reference to the callback function to handle this request.

p_data ArrayBuffer | FormElement | String | Object | Blob nullable

Data to be sent.

p_headers Object nullable

Object containing custom headers.

Returns:
Type Description
XmlHttpRequest
  • Reference to the created XmlHttpRequest object.
Example

//Using 'create'
Suit.request.create("GET","http://webservice.com",function(d,p,e){...},"json");
//Using the shortcut
Suit.request.json.get("http://webservice.com",function(d,p,e){...});

staticSuit.request.json.post(p_url, p_callback, p_data, p_headers){XmlHttpRequest}

Creates a POST request expecting 'json' response.

Name Type Description
p_url String

URL

p_callback RequestCallback

Reference to the callback function to handle this request.

p_data ArrayBuffer | FormElement | String | Object | Blob nullable

Data to be sent.

p_headers Object nullable

Object containing custom headers.

Returns:
Type Description
XmlHttpRequest
  • Reference to the created XmlHttpRequest object.
Example

//Using 'create'
Suit.request.create("POST","http://webservice.com",function(d,p,e){...},"json");
//Using the shortcut
Suit.request.json.post("http://webservice.com",function(d,p,e){...});

comments powered by Disqus