I have a simple JS program that works with JQuery Ajax to ping a website and return the status code:
$.get("https://dev.tylernodes.com", function(data) {
console.log(data);
}).done(function() {
// TO DO ON DONE
}).fail(function(data, textStatus, xhr) {
//This shows status code eg. 403
console.log("error", data.status);
//This shows status message eg. Forbidden
console.log("STATUS: "+xhr);
}).always(function() {
//TO-DO after fail/done request.
console.log("ended");
});
Whenever I use this though, I get an error: net::ERR_NAME_NOT_RESOLVED
I was wondering how would I fix this for the long term?