redirect from javascript function is not working
I have one js file in which there is one function
function deleterec(delid)
{
if(confirm('Are you sure you want to "'+jQuery("#action").attr('value')+'" the selected record(s)?'))
{
document.location.href = siteroot+"/admin/products/delete_store.php?delid="+delid;
}
else
{
return false;
}
In which delid are comm开发者_运维技巧a seperated id passed to function. But in confirmation it does redirect to delete_store.php file in which i write this code
if($_GET['delid']!="")
{
mysql_query("delete from store where id in (".$_GET['delid'].")");
$_SESSION['msg'] = "<span class='success'>Record deleted successfully</span>";
}
But it doesn't work, I think from js function it does not redirect to delete_store.php.
The document.location
can be read-only in some browsers. That can be the problem. Try using window.location
instead.
精彩评论