2014-02-20 13 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”}); }}}); –

相关问题