2012-02-19 180 views
0

當我嘗試在第一個函數裏面發出警報時,它剛好在 var ajax0 = false;它沒有警報和對話框不顯示在所有即使我因爲它不存在不提醒ID,它的內部文件準備jquery'noty'插件無法正常工作

$(document).on("click","a.del_cart",function(){ 
var id = $(this).attr("title"); 
noty({ text: 'product will be deleted',"modal":"true","layout":"center", buttons: [{type: 'button green', text: 'Ok', click: function() { 
var ajax0 = false; 
ajax0 = new XMLHttpRequest(); 
var qst0 = "?id="+id; 
ajax0.open("POST","ajax/del_product.php"+qst0); 
    noty({"text":"cancelled successfully.","layout":"center","type":"success","textAlign":"center","easing":"swing","animateOpen":{"height":"toggle"},"modal":"true","animateClose":{"height":"toggle"},"speed":"500","timeout":"2000","closable":true,"closeOnSelfClick":true}); 
    $(".cart").fadeOut(100,function(){ 
     display_cart(); 
     $(".cart").fadeIn(2000); 
    }); 
ajax0.send(null); 
} }, {type: 'button pink',text: 'Cancel', click: function() { /**/ } }],closable: false,timeout: false }); 
}); 

回答

1

noty{"text":"", ..., "closeOnSelfClick":true}; 

應該是

noty({"text":"", ..., "closeOnSelfClick":true}); 

您缺少括號。

+0

剛纔複製,並在此請感謝 – 2012-02-19 17:10:00

2

你應該把這個noty對象包含在pantheses中。我認爲這是問題。

編輯:ninja'd ..

+0

感謝(以上代碼更新)從網站,但仍然是一個問題,看貼,但嘗試看看更新的代碼,請 – 2012-02-19 17:14:28