Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Single Page App - Checking Connection
$.ajax({
type : "GET",
url : "http://otherdomain.com/somePage.html",
data : params,
timeout: 3000,
dataType : "json",
jsonp : "json",
success : function (response, textS, xhr) {
alert("ok");
},
error : function (xmlHttpRequest, textStatus, errorThrown) {
alert("not ok " + errorThrown);
if(textStatus==='timeout')
alert("request timed out");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment