在表(包含记录,客户凭据,从我的数据库)我有一个删除按钮为每一行。
我想,如果我点击删除按钮,这将删除该行,将记录的ID传递到deletecustomer.php
当我点击删除按钮,我有一个ajax模态,询问是否你想确认行动与否。
问题是,如果我点击CONFIRM(在模式),我的模态将进入delete-utente.php(我有删除行的查询),但ID不通过。
在delete-utente.php中,如果查询正常(删除完成),我会收到一条消息,如果删除无法完成,我会收到另一条消息。
当我点击确认后,我总是有确定消息,但客户并没有被删除。
我想这个问题不是deletecustomer.php,因为如果我使用简单的javascript警报,查询就没关系,我传递标识符成功,但是使用ajax模式,标识符不会被传递。按钮传递变量(Ajax模式)
这是我第一次使用ajax,所以我认为它是ajax代码的问题。
在我的主页上表的代码(newcustomer.php)
<table class="simple-table responsive-table" method="POST" id="customer-list">
//code thead
//rows rows..
<?php echo '<button type="input" class="button icon-trash with-tooltip confirm" onclick="openConfirm()" href="deletecustomer.php?customerid='.$idcustomer.'" title="Delete"></button>'; ?>
//....
</table>
AJAX模式
function openConfirm()
{
$.modal.confirm('Sicuri di voler cancellare il cliente?', function()
{
window.location.href = "deletecustomer.php"; //the php file where I have the delete query
}, function()
{
window.location.href = "newcustomer.php";
});
};
和我走的价值观我deletecustomer.php这样
$customeridd=(int) $_GET['customerid'];
对不起,如果是一个愚蠢的错误或一个愚蠢的问题^^“ 并感谢您的建议
太谢谢你了!这工作完美! 很亲切!再次感谢您:D – JEricaM 2014-09-25 10:30:13
这是我的荣幸:) – 2014-09-25 10:31:34