<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Jaggery - Delicious Javascript</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le styles -->
    <link href="../css/bootstrap.css" rel="stylesheet">
    <style type="text/css">
        body {
            padding-top: 60px;
        }
    </style>
    <link href="../css/prettify.css" rel="stylesheet">
    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="../images/favicon.ico">
    <link rel="apple-touch-icon" href="../images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72"
          href="../images/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114"
          href="../images/apple-touch-icon-114x114.png">
</head>

<body>

<%
include('/includes/topnavi.jag');
%>

<div class="container-fluid" style="width: 960px; margin: auto;">
<div class="row">
    <div class="span16">
        <div class="page-header">
            <h1  id="top">
                Documentation
                <small>API documentation for Jaggery.js</small>
            </h1>
        </div>
    </div>
</div>

<div class="row">
<div class="span4">
    <div class="well">
        <%
        include('/includes/navi.jag');
        %>

    </div>

</div>
<div class="span12">
<div class="content" id="get" name="get">
<h3>get()</h3>

<pre class="prettyprint linenums">
&lt%
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);
%&gt
</pre>
<%

var emailCode = '&lt%'
+ '\n var url  = "https://api.twitter.com/1/statuses/user_timeline.json";'
+ '\n var data = { include_entities:true,include_rts:true,screen_name:"wso2",count:1 };'
+ '\n var twitterJson = get(url, data ,"json");'
+ '\n print(twitterJson);'
+ '\n %&gt';

var codeSnip = encodeURIComponent(emailCode);
var urlString = '../tryitframe.jag?code='+codeSnip;

include('/includes/tryit_but.jag');
%>
    <div id="pageLinks">
        <a class="navilink" href="#overview">Overview</a>
        <%if(hasParams) {%>
        <a class="navilink" href="#parameters">Parameters</a>
        <%}%>
        <%if(hasRets) {%>
        <a class="navilink" href="#returnVals">Return values</a>
        <%}%>
    </div>

<section id="overview">  
	
<h4>Overview</h4>
<p class="description"><code>get()</code> is a wrapper for XMLHTTPRequest's GET method.
using <code>get()</code> you can avoid the use of XHR and shorten the server-side get requests</p>

    <pre class="prettyprint">get(url[, data][, headers][, type][, success(data, xhr)])</pre>
    <pre class="prettyprint">var res = get(url[, data][, headers][, type])</pre>

</section>

    <section id="parameters">
        <h4>Parameters</h4>
        <table class="clsStd operations-table">

            <tbody>

            <tr>

                <th>Parameter</th>
                <th>Type</th>
                <th>Description</th>

            </tr>

            <tr>
                <td><code>url</code></td>
                <td>String</td>
                <td>
		<pre class="prettyprint">var url = "http://www.webservicex.com/globalweather.asmx/GetWeather"</pre>
		The URL which HTTP get is performed</td>
            </tr>
            <tr>
                <td><code>data</code></td>
                <td>Object</td>
                <td>
		<pre class="prettyprint">var param = {CityName: "Dalian", CountryName:"China"}</pre>
		Request parameters</td>
            </tr>
            <tr>
                <td><code>type</code></td>
                <td>String</td>
                <td>
		<pre class="prettyprint">var type = "xml";</pre>
		The type, which the response is expected</td>
            </tr>
            <tr>
                <td><code>headers</code></td>
                <td>Object</td>
                <td>
		<pre class="prettyprint">var headers = {"From": "user@example.com"};</pre>
		Optional HTTP headers</td>
            </tr>
            <tr>
                <td><code>success(data:Object,<br/> xhr:Object)</code></td>
                <td>function</td>
                <td>On success callback</td>
            </tr>
            </tbody>
        </table>
    </section>

    <section id="returnVals">
        <h4>Return values</h4>
        <table class="clsStd operations-table">
            <tbody>
            <tr>
                <th>Value</th>
                <th>Type</th>
                <th>Description</th>
            </tr>
            <tr>
                <td><code>data</code></td><td>Object</td><td>Contains the return data of the HTTP GET request</td>
            </tr><tr>
                <td><code>xhr</code></td><td>Object</td><td>Contains an instance of XMLHTTPRequest</td>
            </tr>
            </tbody>
        </table>
    </section>


</div>
<!-- /get div -->
<br>
<br>
</div>

</div>
<%
include('/includes/footerfunc.jag');
%>


</div>
<!-- /container -->
<%
include('/includes/scripts.jag')
%>

	<script>	
		
		$(document).ready(function(){
        $('#get').toggleClass('active')
		$('#docs').addClass('active')
        });
		
	
		    
		
	</script>
</body>
</html>
