문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top