Skip to content

Instantly share code, notes, and snippets.

@cloaked-ninja
Created April 20, 2016 20:54
Show Gist options
  • Save cloaked-ninja/2602c1b87eab6d818489c9c2847881ed to your computer and use it in GitHub Desktop.
Save cloaked-ninja/2602c1b87eab6d818489c9c2847881ed to your computer and use it in GitHub Desktop.
check 404
UrlExists(sitename2, function(status) {
if (status === 200) {
// file was found
console.log('URL found successfully');
} else if (status === 404) {
// 404 not found
console.log('not this tyme - ' + output);
//runs code to change the output (combined site name/variable)
//make this a while loop - checking that the site name doesn't work
for (var i = 0; i < 11; i++) {
//console.log(i);
var output = sitename.reverse().replace(/(^.*?\/)/g, '').reverse();
console.log(output);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment