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
Post a Comment