$(document).ready(function(){

	// Listen for clicks on the submit button
	$('#do-search').click(function(){

		// Get the search query value
		var query = $('#query').val();

		// Make sure there is a value
		if( $.trim(query) == '' ) {
			
			// Display error message
			console.log('Blank query, show error');
			return;

		}

		// AJAX
		$.ajax({
			url: 'app/apple-search.php',
			type: 'get',
			data: {
				searchQuery: query
			},
			beforeSend: function(){},
			success: function( dataFromServer ){
				console.log( dataFromServer );

				// Loop over each item in the result set
				$(dataFromServer.results).each(function(i){

					$('#search-results').append('<img src="'+dataFromServer.results[i].artworkUrl100+'">');

				});
				
			},
			error: function(){
				console.log('Cannot connect to apple search PHP file');
			}
		});

	});

});
@@ -533,24 +533,96 @@
 mServer );%0A%0A
+%09%09%09%09// Clear the search results div%0A%09%09%09%09$('#search-results').html('');%0A%0A
 %09%09%09%09// Loop 

clear the previous search results