Class Index | File Index

Classes


Namespace Pot.Net


Defined in: <potlite.js>.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Net utilities.
Method Summary
Method Attributes Method Name and Description
<static>  
Pot.Net.getJSON(url, (options))
Get the JSON data by HTTP GET request.
<static>  
Pot.Net.loadScript(url, (options))
Non-blocking script loader.
<static>  
Pot.Net.request(url, (options))
Send HTTP request.
<static>  
Pot.Net.requestByJSONP(url, (options))
Send request by JSONP.
Namespace Detail
Pot.Net
Net utilities.
Method Detail
<static> {Function} Pot.Net.getJSON(url, (options))
Get the JSON data by HTTP GET request.
  var url = 'http://www.example.com/hoge.json';
  getJSON(url).then(function(data) {
    debug(data.results[0].text);
  });
Parameters:
{String} url
The request URL.
{Object} (options)
Request options. (@see Pot.Net.request)
Returns:
{Deferred} Return the instance of Pot.Deferred.

<static> {Function} Pot.Net.loadScript(url, (options))
Non-blocking script loader.
Parameters:
{String} url
The script URL or URI.
{Object|Function} (options)
The loading options.
Returns:
{Deferred} Return the Deferred.

<static> {Function} Pot.Net.request(url, (options))
Send HTTP request.
  Pot.Net.request('/data.cgi', {
    method : 'POST',
    sendContent : {
      query  : 'Book OR Media',
      start  : 0,
      length : 15,
      format : 'json'
    },
    mimeType : 'application/json',
    headers : {
      'Content-Type' : 'text/javascript'
    }
  }).then(function(res) {
    debug(res.responseText);
  }, function(err) {
    debug('Error!');
    debug(err);
  });
Parameters:
{String} url
The request URL.
{Object} (options)
Request options.
                                +----------------------------------
                                | Available options:
                                +----------------------------------
                                - method       : {String}    'GET'
                                - sendContent  : {Object}    null
                                - queryString  : {Object}    null
                                - username     : {String}    null
                                - password     : {String}    null
                                - headers      : {Object}    null
                                - mimeType     : {String}    null
                                - cache        : {Boolean}   true
                                - sync         : {Boolean}   false
                                - responseType : {String}    null
                                - binary       : {Boolean}   false
                                - cookie       : {Boolean}   false
                                - crossDomain  : {Boolean}   false
                                
Returns:
{Deferred} Return the instance of Pot.Deferred.

<static> {Function} Pot.Net.requestByJSONP(url, (options))
Send request by JSONP.
  // Same as jQuery.jsonp usage.
  var url = 'http://www.example.com/jsonpTest?callback=?';
  Pot.Net.requestByJSONP(url, {
    queryString : {
      q : 'JavaScript OR ECMAScript'
    }
  }).then(function(data) {
    debug(data.results[0].text);
  });
Parameters:
{String} url
The request URL.
{Object} (options)
Request options.
                                +------------------------------------
                                | Available options:
                                +------------------------------------
                                - queryString : {Object}   null
                                - cache       : {Boolean}  false
                                - sync        : {Boolean}  false
                                - callback    : {String}   'callback'
                                
Returns:
{Deferred} Return the instance of Pot.Deferred.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Sep 21 2012 19:35:45 GMT+0900 (JST)