Reputation: 2205
I am using jConfirm for confirm dialog with success.
For first time i tried to call it inside the ajax success but seems to fail.
Here is the code:
success: function (j) {
if(j.status)
{
jConfirm('File Already exist.Are you sure you want to replace ?', 'File Exist', function(r) {
if (r==true)
{ }
else
{
//code for cancel
}
});
}
}//success
The problem is that the dialog is show but does not wait for user answer and continues.
When change to classic javascript confirm everything works fine!
Upvotes: 0
Views: 897
Reputation: 887509
jConfirm
is an asynchronous method.
As you've noticed, it returns immediately, without waiting for the user to close the dialog.
You need to put all of your code in the jConfirm
callback.
Upvotes: 1