Deleting cookies with javascript?

Discussion in 'JavaScript' started by JuranHuman, Sep 5, 2010.

  1. #1
    Hi

    I am working on a .net basket where I save the info for the products in the basket etc in a cookie.

    Now I have an html button on the basket page where I want to be able to delete the product (Cookie).

    I am using
    <script type="text/javascript">
            function delete_cookie ( cookie_name )
            {
                expires = Now();
                document.cookie = cookie_Name+"= ;expires="+expires.toGMTString();
            }
    
        </script>
    Code (markup):
    But I get an error that says the cookie is not delcared? But it does exist because I retrive the name of the cookie when looping through the cookie list.

    What am I doing wrong here?
     
    JuranHuman, Sep 5, 2010 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Javascript is case sensitive, so it should work if you change cookie_Name to cookie_name
     
    Cash Nebula, Sep 6, 2010 IP