jquery - $.ajax always go to error callback function -
i trying check if file exist or not when run code go error callback function if filename url of existing file. why $.ajax
enter error callback function?
$.ajax({ url: filename, type: 'get', datatype: 'text', async: false, cache: false, success: function () { alert('file found.'); }, error: function () { alert('file not found.'); } });
there more problems:
the file might not think is
the file might crash , fail respond
the file might run long while , request might crash due timeout
you should check these possibilities.
Comments
Post a Comment