In the case of creating data forms, or other forms, there may be times that you want to verify if the file exists before doing other actions. 

You can do this easily with the $.ajax() function for jQuery. This example creates a clickable element to set off the checking procedure.

    var checkFileName = $("#verbInfinitive").val();
    var checkFilePath = "verbtemp/" + checkFileName + ".json";
        type: 'POST',
        url: checkFilePath,
        success: function(){
            alert(checkFilePath + " This file already exists");
        error: function(){
            alert(checkFilePath + " This file does not exist.");

Of course, you can easily associate other actions other than an alert box to run if the file exists or does not exist.

success: returns true if the file was found

error: returns true if the file was not found