Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (27 sloc) 0.783 kB
<html>
<head>
<title>Request Demo</title>
</head>
<body>
A demonstration of cross domain requests.
<pre id="output">
</pre>
</body>
<script type="text/javascript" src="jquery-min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var Request = require('request').Request;
var latestTweetRequest = Request({
url: "http://api.twitter.com/1/statuses/public_timeline.json",
onComplete: function (response) {
console.log("... request complete!");
var tweet = response.json[0];
$("#output").text("User: " + tweet.user.screen_name + "\n" +
"Tweet: " + tweet.text);
}
});
console.log("issuing latest tweet request...");
latestTweetRequest.get();
});
</script>
</html>
Jump to Line
Something went wrong with that request. Please try again.