check for endpoint before making AJAX calls