Is there any way to create blocking dialog box using Javascript/JQuery/Ajax …
I have used the JQuery UI dialog box. As this is an asynchronous function, I used callback functions. However it makes a simple JS code of if/else very complex.
e.g.
ans1 = confirmBox("something");
if(ans1){
ans2 = dialogBox();
if(ans2)
alertBox();
else {
ans3 = dialogBox();
....
}
}
else {
}
… rest of the code
Callbacks make this very complicated. Is there an alternative to this?
There is no way to make JavaScript block and wait for a condition. You need to use the callback method.
Maybe if you are needing all of these steps, it would be better to do it in a different manner.