javascript - How can we call Ajax "error: function()" function manually from success function? -


how can call error: function manually success:function ? possible ?

success: function(data) {     response($.map(data, function(item) {       if (item != "some value") {         // call error:function here        }       return item;     }))   },   error: function(xhr, status, error) {     var err = eval("(" + xhr.responsetext + ")");     alert(err.message);   } 

like this:

success: function(data) {     response($.map(data, function(item) {         if (item != "some value") {             onerror(...)          }         return item;     })) }, error: onerror   var onerror = function(xhr, status, error) {     var err = eval("(" + xhr.responsetext + ")");     alert(err.message); }  

by way, use eval never idea.


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -