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