How to load two or more popup in sequence

How to load two or more popup in sequence

I wanna use JS to load two or more popups in sequence, after i close the first popup, then display the second one . but it looks not working

$("#popupMSG1").popup('open');

$("#popupMSG2").popup('open');


how can i do that? 

thanks a lot!