get()
<%
var url = "https://api.twitter.com/1/statuses/user_timeline.json";
var data = { include_entities:true,include_rts:true,screen_name:"wso2",count:1 };
var twitterJson = get(url, data ,"json");
print(twitterJson);
%>
Overview
get()
is a wrapper for XMLHTTPRequest's GET method. using get() you can avoid the use of XHR and shorten the server-side get requests
get(url[, data][, headers][, type][, success(data, xhr)])
var res = get(url[, data][, headers][, type])
Parameters
Parameter |
Type |
Description |
url | String | var url = "http://www.webservicex.com/globalweather.asmx/GetWeather" The URL which HTTP get is performed |
data | Object | var param = {CityName: "Dalian", CountryName:"China"} Request parameters |
type | String | var type = "xml"; The type, which the response is expected |
headers | Object | var headers = {"From": "user@example.com"}; Optional HTTP headers |
success(data:Object, xhr:Object) | function | On success callback |
Return values
Value |
Type |
Description |
data | Object | Contains the return data of the HTTP GET request |
xhr | Object | Contains an instance of XMLHTTPRequest |