Basically I am looping through tweets. I want to pause for 20seconds between each tweet and after the last tweet I want to go back to tweet one and repeat the process infinitely.
Here is my code so far, I've tried tackling this problem by reading other peoples examples but cant quite seem to hit the nail on the head. I do keep running into the set timeout function too.
// DisplayTweets.
function displayTweets(tweets)
{
// Checks if any tweets exist.
if ($.isArray(tweets) !== false)
{
// Show error message.
$('p#tweet').text(tweets);
}
else
{
// Parse JSON into Javascript object.
var objTweets = jQuery.parseJSON(tweets);
// Loop through
$.each(objTweets, function(i, objTweet) {
//alert(objTweet.tweet);
$('p#tweet').text(objTweet.tweet);
});
}
}
!== falsewhy not just use== trueor just omit it altogether...if($.isArray(tweets)){...}.. it makes your code much easier to read.