Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2008
    Posts
    54
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Remove from Cart Not Working Anymore in Chrome

    PHP Code:
       <input name="button" type="button" class="red" onclick="remove('<?php echo($counter); ?>')" value=" X"/>
    And the js:
    Code:
    function remove(id)
    	{
    		if(confirm('Are you sure you want to delete this product from your cart?'))
    		{
    			document.getElementById("frmCart").action="cart.php?id="+id;
    			document.getElementById("frmCart").submit();
    		}
    	}

  • #2
    Regular Coder
    Join Date
    Nov 2012
    Posts
    115
    Thanks
    7
    Thanked 12 Times in 12 Posts
    Have you tried debugging this?

    First place I'd start is actually rewriting remove() as such:
    Code:
    function remove(id) {
    	alert(id);
    	if(confirm('Are you sure you want to delete this product from your cart?')) {
    		document.getElementById("frmCart").action="cart.php?id="+id;
    		alert(document.getElementById("frmCart").action);
    		//document.getElementById("frmCart").submit();
    	}
    }
    The first alert outputs the ID passed into the function. Does that still work? (Don't see any reason why it shouldn't). The second one outputs the current status of frmCart.action, but that seems fine too.

    If that doesn't resolve anything, what does your browsers error log say? In Chromium this is under developer tools, Chrome shouldn't be far off.

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Not a thing to do with PHP. PHP does not care about what browser is in use, so if one works and another does not that is your client side scripting that is causing that.

    Moving from PHP forum to Javascript forum.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •