pawiromitchel
1/27/2017 - 11:27 AM

JS - check if an object or url exists

JS - check if an object or url exists

function urlExists(testUrl) {
    var http = $.ajax({
        type:"HEAD",
        url: testUrl,
        async: false
    })
    return http.status;
    // this will return 200 on success, and 0 or negative value on error
}