Check for the Existence of a File
Uses an ajax function to check if a file exists. If the file is there, the function for success is processed. Any other failure causes the processing of the error function router.
Step 1
Create the script using the code that follows...
- 
                
                function checkFile() { 
$.ajax({
url: 'filename.tst',
type: 'HEAD',
success: function() { window.alert('file found') }, // this routine processes if found
error: function() { window.alert('file not found') } // this routine processes if there is an error
});
}
Step 2
Call the function from the within the HTML...
- 
                  <button onclick="checkFile()">Generate Page </button>
                
