javascript - How to rewrite the following sync code to async? -


how rewrite using async_ajax()?

function some_event_handler () {   if (condition) {     sync_ajax();     ajax_dependent_code1;   } else {     ajax_independent_code;   }   ajax_dependent_code2; } 

i did in following way:

function some_event_handler () {   async_ajax(callback_function () {     if (condition) {       ajax_dependent_code1;     } else {       ajax_independent_code;     }     ajax_dependent_code2;   }); } 

i hope okay...


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -