function load_more_tweets() {
	//Check if there are more tweets to load.
	if(nextSetOfTweets) {
		// Make another search if there are more.
		$.get("scripts/php/search_twitter.php?next_results="+encodeURIComponent(nextSetOfTweets), function(response) {
			// Check for errors and parse the json data.
			var jsonData = JSON.parse(response);
			$("#error_result").html("");
			if(jsonData.hasOwnProperty('errors')) { 
				$.each(jsonData.errors, function(key, val) {
					$("#error_result").append(val.message + "<br>");
				});
				return false;
			}else {
				// Check if there are more results.
				if(jsonData.search_metadata.hasOwnProperty("next_results")) {
					nextSetOfTweets = jsonData.search_metadata.next_results;
				}else {
					nextSetOfTweets = "";
				}
				
				// Add more cards to the results.
				buildTweetCard(jsonData);
			}
		}).then(function() {
			$("#found_results").html("Showing "+foundTweetCount+" tweets (scroll down to load more).");
		});
	}else {
		// If there are no more tweets to load, hide the button for loading them.
		$("#loading_button").css("display", "none");
	}
}
/*
* This function loads more tweets on to the page if there are more tweets to load.
*/
This function loads more tweets on to the page if there are more tweets to load.
This function loads more tweets on to the page if there are more tweets to load .
function load_more_tweets() {
	if(nextSetOfTweets) {
		$.get("scripts/php/search_twitter.php?next_results="+encodeURIComponent(nextSetOfTweets), function(response) {
			var jsonData = JSON.parse(response);
			$("#error_result").html("");
			if(jsonData.hasOwnProperty('errors')) { 
				$.each(jsonData.errors, function(key, val) {
					$("#error_result").append(val.message + "<br>");
				});
				return false;
			}else {
				if(jsonData.search_metadata.hasOwnProperty("next_results")) {
					nextSetOfTweets = jsonData.search_metadata.next_results;
				}else {
					nextSetOfTweets = "";
				}
				buildTweetCard(jsonData);
			}
		}).then(function() {
			$("#found_results").html("Showing "+foundTweetCount+" tweets (scroll down to load more).");
		});
	}else {
		$("#loading_button").css("display", "none");
	}
}
function load_more_tweets ( ) { if ( nextSetOfTweets ) { $ . get ( "scripts/php/search_twitter.php?next_results=" + encodeURIComponent ( nextSetOfTweets ) , function ( response ) { var jsonData = JSON . parse ( response ) ; $ ( "#error_result" ) . html ( "" ) ; if ( jsonData . hasOwnProperty ( 'errors' ) ) { $ . each ( jsonData . errors , function ( key , val ) { $ ( "#error_result" ) . append ( val . message + "<br>" ) ; } ) ; return false ; } else { if ( jsonData . search_metadata . hasOwnProperty ( "next_results" ) ) { nextSetOfTweets = jsonData . search_metadata . next_results ; } else { nextSetOfTweets = "" ; } buildTweetCard ( jsonData ) ; } } ) . then ( function ( ) { $ ( "#found_results" ) . html ( "Showing " + foundTweetCount + " tweets (scroll down to load more)." ) ; } ) ; } else { $ ( "#loading_button" ) . css ( "display" , "none" ) ; } }
This function loads more tweets on to the page if there are more tweets to load.
This function loads more tweets on to the page if there are more tweets to load .
//Check if there are more tweets to load. // Make another search if there are more. // Check for errors and parse the json data. // Check if there are more results. // Add more cards to the results. // If there are no more tweets to load, hide the button for loading them.