jquery - Javascript method synchronous call without callback and $.ajax -
welcome,
i want call synchronous javascript method without callbacks. method post asynchronous.
function somemethod() { var bean; //bean proxy object provide external library if(clicked_onspecial_field) { if(!bean.isauthorized()) { //here async call return false; } } //a lot of other instructions... }
from 1 hand clicked_onspecial_field = false
cannot put other instructions in callback. hand bean
provide me proxy object. in case don't know in way can use $.ajax
.
could please help?
i want call synchronous javascript method without callbacks. method post asynchronous
if method inherently asynchronous, cannot call returns synchronously. that's outright impossible. see how return response asynchronous call? details.
usually
clicked_onspecial_field = false
cannot put other instructions in callback.
of course can!
function somemethod() { var bean; //bean proxy object provide external library if (clicked_onspecial_field) { bean.isauthorized(goon); // pass goon callback } else { goon(true); // call directly if there's no async action } function goon(cond) { //a lot of other instructions... } }
notice somemethod
asynchronous well, if need pass results you'd need use callback there well.
Comments
Post a Comment