2014-02-20 40 views
0

我收到點擊刪除鏈接的對話框。但問題是當我點擊刪除鏈接時,它會自行刪除相關行,單擊是。我想在zf view/index.phtml中使用Ajax控制對話框的是和否按鈕,並刪除控制器的動作。請幫助me.and謝謝:)我想在zf的對話框的刪除按鈕上調用ajax。

"Yes": function() { 
$.ajax({ 
type: "POST", 
url: "/therapyServices/delete", 
dataType: "json", 
data: "id="+id, 
success: "Congratulations" }); }, 
"No" : function(){ 
$btnvalid= false; 
(this).dialog("close"); } 

回答

0

您可以使用它的document.ready函數像這樣

$(document).ready(function(){ 

$("#idOfYesLink").click(function() 
{ 
    //call ajax here to delete row from database 
}); 

$("#idOfNoLink").click(function() 
{ 
    //Close dialog box and do no action 
}); 

}); 

可能這是有幫助的 指導我,如果我錯了 謝謝

+0

$(函數(){$( 「#對話」)對話框({按鈕:{ 「是」:函數(){$ 阿賈克斯({ 類型: 「POST」, url:「/ therapyServices /」, dataType:「json」, data:「id =」+ id, success:「Congratulation」}); }}}); –

相關問題