javascript - How to use ajax return value from within a function call? -


i have function shown below , not able return data value place calling function.

  function checkifrs(){         $.ajax({                 url: 'someurl.php',                 success: function(data) {                                 return data;                             }                 });     } 

any suggestions helpful...

well , 1 way use callback function inside ajax success

function checkifrs(callback) {     $.ajax({         url: 'someurl.php',         success: function(data) {             callback(data);          }     });  } 

and call way,

 checkifrs(function(data){       //do data   }); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -