2013-07-13 68 views
2

我使用Alertify jQuery插件,可以顯示alert,confirm, dialog框。JQuery的Alertify確認對話框不能正常工作

問題現在面臨的確認,它無法正常就ok了工作,或者取消單擊

Sample JS FIDDLE

JS代碼:

function myconfrm() { 
var falgset = true; 
alertify.confirm("Are you sure to delete this record.", function (e) { 
    if (e) { 
      // user clicked "ok" 
      falgset = false; 
     } 
    }); 
    alert(falgset); 
    return falgset; 
} 

$("#btn").live('click', function (event) { 
       if (myconfrm()) { 
        // my ajax call 
      } 
}); 
+0

只是想知道:我注意到你的'Alertify'(頂部的單詞)看起來很酷。你是怎樣做的? –

+1

你能演出嗎? – Homam

+2

@讓 - 保羅:我使用kbd標籤的效果, –

回答

6

這是我如何解決
JS Fiddle DEMO

$("#btn").live("click", function() { 
    alertify.confirm("Are you sure you want to delete?", function (asc) { 
     if (asc) { 
      //ajax call for delete  
      alertify.success("Record is deleted."); 

     } else { 
      alertify.error("You've clicked cancel"); 
     } 
    }, "Default Value"); 
});