Answer the question
In order to leave comments, you need to log in
Modal dialog boxes via AJAX?
The essence of the problem:
There is a certain function (20th in the list in the call stack). It brings up a modal window.
When rewriting the GUI for the Web UI, the question arose of implementing the modality through AJAX .
To give the window to the browser, you need to end the thread in which the function of launching the modal window was executed.
To end the thread, you need to get the results of the dialog box. This is the crux of the problem.
Two unsuccessful solutions:
1. Cut all 20 functions into 2 parts. Everything up to the modal window, and the window itself is given and processed in the first thread.
Everything after is in the second. It is necessary to cut the functions into 2 in order to be able to separate the “before” and “after”.
2. Stop the thread that has reached the modal window. Create a second thread that gives the browser a modal window. On return from the modal window, restore the first thread.
The first option breaks the principles of OOP, it is laborious. The second option is difficult to implement, requires low-level work and intervention in existing modules.
Is there a better option?
Answer the question
In order to leave comments, you need to log in
Do it through callback... If you need data higher in the function, raise the callback to a higher level...
there was a problem:
// actions before the dialog...
var result = dialog.showModal(params);
// actions after the dialog...
there is a problem:
// actions before the dialog...
dialog.showModal(params, function(result){
// actions after the dialog...
});
If I understand correctly, it may help to look at the implementation of async = false in the .ajax method of the jQuery framework.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question