Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我想在php中删除时添加弹出确认消息。怎样_Javascript_Php_Jquery - Fatal编程技术网

Javascript 我想在php中删除时添加弹出确认消息。怎样

Javascript 我想在php中删除时添加弹出确认消息。怎样,javascript,php,jquery,Javascript,Php,Jquery,当我按下删除按钮,然后在弹出窗口中显示确认消息时,我需要此选项。如果我按“是”按钮,则它将删除,否则将删除“否”。请按照此按钮查看jquery删除确认消息 echo "<td><a onClick=\"javascript: return confirm('Please confirm deletion');\" href='delete.php?id=".$query2['id']."'>x</a></td><tr>"; //use

当我按下删除按钮,然后在弹出窗口中显示确认消息时,我需要此选项。如果我按“是”按钮,则它将删除,否则将删除“否”。

请按照此按钮查看jquery删除确认消息

echo "<td><a onClick=\"javascript: return confirm('Please confirm deletion');\" href='delete.php?id=".$query2['id']."'>x</a></td><tr>"; //use double quotes for js inside php!
HTML 你可以用。这是弹出窗口的jquery插件。对于删除弹出窗口,SweetAlert提供以下代码段

swal({
  title: "Are you sure?",
  text: "You will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false
},
function(){
  swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
遵循与项目集成的文档。
如果您在集成它时遇到任何困难,请告诉我们。

您可以用单行代码来完成

<a onclick="return confirm('Sure?');" href="http://example.com/delete">Delete</a>

在此处添加您的html和js。是否尝试在internet上搜索此内容?是否要添加jquery弹出窗口或浏览器确认框?。live自jquery1.7以来已被弃用,并已从jquery1.9中删除。最好使用。打开。被否决。是的,你是对的:
$("a.removeRecord").live("click",function(event){
   event.stopPropagation();
   if(confirm("Do you want to delete?")) {
    this.click;
       alert("Ok");
   }
   else
   {
       alert("Cancel");
   }       
   event.preventDefault();

});
swal({
  title: "Are you sure?",
  text: "You will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false
},
function(){
  swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
<a onclick="return confirm('Sure?');" href="http://example.com/delete">Delete</a>