简体   繁体   English

jQuery对话框确认到具有PHP变量的特定href链接

[英]Jquery dialog confirmation to a specific a href link with php variable

I want to pop up a jquery confirmation dialog when i press to delete an item from my database, the code above is inside a while($records=mysql_fetch_aray) so i have several records: 当我按一下以从数据库中删除一个项目时,我想弹出一个jQuery确认对话框,上面的代码在一段while($records=mysql_fetch_aray)所以我有几条记录:

echo"<tr>
    <td>".$registo["id_produto"]."</td>
    <td><img src='data:image/jpeg;base64,".base64_encode($registo["pic"])."' width='80' height='80'></td>
    <td>".$registo["nome"]."</td>
    <td>".$registo["preco"]."</td>
    <td>".$registo["quantidade"]."</td>
    <td>".$categoria."</td>
    <td>".$registo["descricao"]."</td>
    <td>".$registo["cura"]."</td>
    <td>".$registo["aroma"]."</td>
    <td><a href='deleteProduto.php?id={$registo["id_produto"]}'><i class='fa fa-times'></i> Delete</a></td>
    </tr>";

When i press the "delete" button i wanted to pop up a jquery confirmation dialog with a "yes" and "no" and when pressed yes go to "deleteProduto.php" with the respective id of the item i want to delete. 当我按下“删除”按钮时,我想弹出一个带有“是”和“否”的jquery确认对话框,当按下“是”时,请转到“ deleteProduto.php”,并带有要删除的项目的相应ID。

I've searched about this but only finded this working with a form and i only want it to work with the 'a href' link with the respective "id". 我已经搜索过此内容,但只发现它可以与表单一起使用,并且我只希望它与带有相应“ id”的“ a href”链接一起使用。

I wonder how your code is working at all without tons of warnings and errors. 我不知道您的代码在没有大量警告和错误的情况下是如何工作的。

I think you propably didnt notice it, because you did it correctly in the rest of the code but 我认为您可能没有注意到它,因为您在其余代码中正确地做到了,但是

"...?id={$registo["id_produto"]}'>...";

is definetely no proper string composing. 绝对没有适当的字符串组成。 It hast to be 不一定要

"...?id=".$registo["id_produto"]."'>...";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM