【发布时间】:2012-07-16 23:29:32
【问题描述】:
我有一个表格,其中填充了数据库中的数据,其中每一行都有一个单元格,里面有一个锚元素。这个锚点会指向同一个页面,但有一个查询字符串告诉 php 哪一行包含它应该删除的数据。
当用户单击锚点时,我需要打开一个 jQuery 对话框,要求他在加载 url 之前确认他的意图。 “取消”按钮应该关闭对话框并且什么都不做。然后“确定”按钮应该让 URL 打开。
非常感谢任何帮助。
// 使用“我尝试过的”进行编辑。这是我第一次弄乱 jQuery,学习的时间已经不多了... =(
jQuery(document).ready(function(){
var $dialog = jQuery('<div class='msg_dialog'></div>')
.html('Are you sure you want to do this?')
.dialog({
autoOpen: false,
title: 'Confirm action',
buttons: [{
text: "Cancel",
click: function(){
jQuery(this).dialog("close");
}
}] // didn't even try the OK button since I couldn't even get the dialog opened
});
jQuery('#confirm_del').click(function(){
$dialog.dialog('open');
return false;
});
});
【问题讨论】:
-
对不起。我已经编辑了我的问题。
-
您应该使用
POST,而不是GET(查询字符串)。 Read this。 (有一条评论——That's why you should always POST for changing actions.——总结一下。) -
有趣的链接,谢谢。好吧,这是我正在编写的 wordpress 插件的一部分。用户必须登录才能看到任何东西,所以我相信没有任何机器人能够在不发现一些管理员密码的情况下进入。无论如何,在通过单击链接而不是通过提交表单来更改操作的情况下,如何使用 POST?
标签: php jquery html jquery-ui jquery-ui-dialog