所以,我试图做一个包含删除按钮以删除按钮后。 问题是..删除按钮提交表单,我不能预先定义我的按钮类/ ID,因为它是多次beeing echo'd(php脚本读取目录,然后将所有文件放在一个表中)表单提交后隐藏表格内的按钮?
这是当前脚本,它在后台发布表单,但它不隐藏元素,我自己尝试了一些东西,但是脚本最终隐藏了页面上的所有按钮,或者它不起作用所有..
按钮beeing回显:
echo "<input type='submit' value='delete' name='submit'>";
其背后的脚本:
$("#delform").submit(function() {
var url = "../../setdel.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#delform").serialize(), // serializes the form's elements.
success: function(data)
{
// location.reload(); // show response from the php script.
}
});
return false; // avoid to execute the actual submit of the form.
});
@PHPglue OP使用'submit'按钮,这通常会导致网页提交/刷新反正 – jasonscript 2014-09-19 01:31:32
我不知道任何其他方式,我脚本从当前登录的用户读出目录,然后显示表中的所有文件,并且我知道如何处理删除的唯一方法是使用提交给正在删除所选文件的php文件的表单。 – Sjef92 2014-09-19 01:42:40