$.get(url)
.done(function (responseText) {
// things to do when file is found and use below condition
// if only the server redirection is on
a = responseText
if (a.search("a sample string from response html") < 0) {
// thing to do when file is found and not redirected
} else {
// thing to do when file is not found and redirected
}
}).fail(function () { // Network error
});