Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First results on google:</p> <p><a href="http://ralphwhitbeck.com/2007/11/20/PullingTwitterUpdatesWithJSONAndJQuery.aspx" rel="nofollow">Ralph Whitbeck - Blog - Pulling twitter updates with JSON and jQuery</a>. Code below:</p> <pre><code>var url = "http://twitter.com/status/user_timeline/RedWolves.json?count=3&amp;callback=?"; $.getJSON(url, function(data){ $.each(data, function(i, item) { $("img#profile").attr("src", item.user["profile_image_url"]); $("#tweets ul").append("&lt;li&gt;" + item.text.linkify() + " &lt;span class='created_at'&gt;" + relative_time(item.created_at) + " via " + item.source + "&lt;/span&gt;&lt;/li&gt;"); }); }); </code></pre> <p>And the html:</p> <pre><code>&lt;div id="tweets"&gt; &lt;img id="profile"&gt; &lt;ul&gt;&lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Another example. <a href="http://lupomontero.com/fetching-tweets-with-jquery-and-the-twitter-json-api/" rel="nofollow">Fetching tweets with jQuery and the Twitter JSON API</a>. Reproducing below:</p> <pre><code>$(document).ready(function() { // Declare variables to hold twitter API url and user name var twitter_api_url = 'http://search.twitter.com/search.json'; var twitter_user = 'lupomontero'; // Enable caching $.ajaxSetup({ cache: true }); // Send JSON request // The returned JSON object will have a property called "results" where we find // a list of the tweets matching our request query $.getJSON( twitter_api_url + '?callback=?&amp;rpp=5&amp;q=from:' + twitter_user, function(data) { $.each(data.results, function(i, tweet) { // Uncomment line below to show tweet data in Fire Bug console // Very helpful to find out what is available in the tweet objects //console.log(tweet); // Before we continue we check that we got data if(tweet.text !== undefined) { // Calculate how many hours ago was the tweet posted var date_tweet = new Date(tweet.created_at); var date_now = new Date(); var date_diff = date_now - date_tweet; var hours = Math.round(date_diff/(1000*60*60)); // Build the html string for the current tweet var tweet_html = '&lt;div class="tweet_text"&gt;'; tweet_html += '&lt;a href="http://www.twitter.com/'; tweet_html += twitter_user + '/status/' + tweet.id + '"&gt;'; tweet_html += tweet.text + '&lt;\/a&gt;&lt;\/div&gt;'; tweet_html += '&lt;div class="tweet_hours"&gt;' + hours; tweet_html += ' hours ago&lt;\/div&gt;'; // Append html string to tweet_container div $('#tweet_container').append(tweet_html); } }); } ); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload