In a unique situation on my webpage, I have a varying number of grids. When the user clicks a button, I need to perform the following steps:
For each grid
- Retrieve data from the grid
- Prompt the user to input additional data in a dialog box
- Execute a $.post() operation after the dialog box is closed
- Move on to process the next grid
Below is a snippet of the code I am working with:
for (var i = 0; i < grids.length; i++) {
var grid = grids[i];
// Process some grid's data
...
// Prompt the user with a dialog box for extra data input
dialog.open(); // dialog refers to a Telerik Window widget
// Trigger a $.post() request upon closing the dialog box
$.post(...)
.fail(function(error) {
})
.done(function(data) {
});
}
The issue I'm encountering lies in the asynchronous behavior of the dialog box (leveraging Telerik Window widget). Therefore, I seek assistance in converting the for loop to make the process synchronous.
Is there anyone who can guide me on how to achieve this?
Thank you.