Javascript window.location.assign不';我不能继续
我正在尝试删除数据库中的记录 HTML PHPJavascript window.location.assign不';我不能继续,javascript,php,Javascript,Php,我正在尝试删除数据库中的记录 HTML PHP window.location.assign()后请添加return false; 像这样 window.location.assign("deleteunit.php?val="+unit); return false; 欢迎来到堆栈溢出!请仔细阅读,特别是“不继续”是什么意思?(旁注:使用GET修改服务器状态是一种反模式。GET应该是幂等的。)代码的更多问题:mysql.*不推荐使用,请改用mysqli。此代码易受SQL注入攻击。请使用事先准
window.location.assign()后请添加return false; 像这样
window.location.assign("deleteunit.php?val="+unit);
return false;
欢迎来到堆栈溢出!请仔细阅读,特别是“不继续”是什么意思?(旁注:使用GET修改服务器状态是一种反模式。GET应该是幂等的。)代码的更多问题:
mysql.*
不推荐使用,请改用mysqli
。此代码易受SQL注入攻击。请使用事先准备好的语句!它起作用了。在调用函数onclick之前,我还添加了return
function delUnit(unit)
{
var r=window.confirm("Are you sure you want to delete this unit?");
if (r==true)
{
//window.alert(val); I used alert to see if val was containing the word grams
window.location.assign("deleteunit.php?val="+unit);
return false;
}
}
$val = $_GET['val'];
mysql_query("DELETE FROM setuptb WHERE val='$val' AND category='UNIT'");
window.location.assign("deleteunit.php?val="+unit);
return false;