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:

  1. the file might not think is

  2. the file might crash , fail respond

  3. the file might run long while , request might crash due timeout

you should check these possibilities.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -