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

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -