ajax code
$.ajax({
type: 'GET',
dataType: 'json',
url: url,
timeout: 5000,
success: function(data, textStatus ){
alert('request successful');
},
fail: function(xhr, textStatus, errorThrown){
alert('request failed');
}
});