开发者

redirect from javascript function is not working

开发者 https://www.devze.com 2023-03-06 19:38 出处:网络
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)?\'))

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消