how to open dialog box sequencely and waiting for input?

how to open dialog box sequencely and waiting for input?

I have no idea how to open multi dialog in loop, but before open the next make it get input from user frist.
for easier: I want it to act like prompt in javascript.

example:

I want it to act like:
for(var i = 0;i < 10; i++)
{
       var person = prompt("Please enter your name","Harry Potter");
}

but if I do this:

$.mobile.changePage("#myDialog",{transition: 'slidedown', reverse: false, changeHash: true, role: 'dialog'});

it will continue open dialog and never stop for user input before open the next one!!!