Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>THanks to Edgar and Vipul for there help. Unfortunately they were able to answer my questions. I have managed to work out that the issue was a combination of jquery not parsing the json properly and needing to use jsonp with topsy.</p> <p>Here is a little test I created that works.</p> <p>Create a doc with this object on it ....</p> <pre><code>&lt;a href="#" id="gettweets"&gt;RUN TEST&lt;/a&gt; </code></pre> <p>You will need JQUERY</p> <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"&gt;&lt;/script&gt; </code></pre> <p>And put the following in a script too. The is cycle through the required number of tweets from Topsy.</p> <p>Thanks again everyone.</p> <pre><code>$("#gettweets").live('click', function(event){ event.preventDefault(); getTweets('stephenbaugh'); }); var MAX_TWEETS = 500; var TWEETSPERPAGE = 50; var BASE = 'http://otter.topsy.com/search.json'; var currentpage; var responcesreceived; var totalweets; var pagestoget; var totalweets; var TWEETSPERPAGE; var holdtweetslist = []; var requestssent; var responcesreceived; var tweetsfound; var nametoget; function getTweets(name) { nametoget=name; currentpage = 1; responcesreceived = 0; pagestoget = 0; var BASE = 'http://otter.topsy.com/search.js?type=tweet&amp;perpage=' + TWEETSPERPAGE + '&amp;window=a&amp;nohidden=0&amp;q=@' + nametoget + '&amp;page=1'; $('#gettweets').html(BASE); $.ajax({url: BASE, dataType: 'jsonp', success : function(data) { getalltweets(data); } }); }; function getalltweets(data) { totalweets = data.response.total; $('#gettweets').append('&lt;p&gt;'+"total tweets " + totalweets+'&lt;/p&gt;'); $('#gettweets').append('&lt;p&gt;'+"max tweets " + MAX_TWEETS+'&lt;/p&gt;'); if (MAX_TWEETS &lt; totalweets) { totalweets = 500 } $('#gettweets').append('&lt;p&gt;'+"new total tweets " + totalweets+'&lt;/p&gt;'); gotTweets(data); pagestoget = Math.ceil(totalweets/TWEETSPERPAGE); var getpagesint = self.setInterval(function() { currentpage = ++currentpage; var BASE = 'http://otter.topsy.com/search.js?type=tweet&amp;perpage=' + TWEETSPERPAGE + '&amp;window=a&amp;nohidden=0&amp;q=@' + nametoget + '&amp;page=' + currentpage; $.ajax({url: BASE, dataType: 'jsonp', success : function(data) { gotTweets(data); } }); if (currentpage == pagestoget) { $('#gettweets').append('&lt;p&gt;'+"finished sending " + currentpage+ ' of ' + pagestoget + '&lt;/p&gt;'); clearInterval(getpagesint); }; }, 2000); }; function gotTweets(data) { responcesreceived = responcesreceived + 1; holdlist = data.response.list; for (x in holdlist) { holdtweetslist.push(holdlist[x]); } // var family = parents.concat(children); $('#gettweets').append('&lt;p&gt;receipt # ' + responcesreceived+' - is page : ' +data.response.page+ ' array length = ' + holdtweetslist.length +'&lt;/p&gt;'); // holdtweetslist.Merge(response.list); tweetsfound = tweetsfound + data.response.total; if (responcesreceived == pagestoget) { // sendforprocessingsendtweetlist(); $('#gettweets').append('&lt;p&gt;'+"finished receiving " + responcesreceived + ' of ' + pagestoget + '&lt;/p&gt;'); } } </code></pre>
 

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