Clear cookie with javascript or php script -
i have problem need guys me.i set cookie javascript when user make change select tag in html code , clear want clear it.
* if in php script need clear or delete , if in jquery script need delete old 1 , set new 1 of cookie value when user make change select tag. let's see script below.
jquery script
<script type="text/javascript"> $(function(){ $('#category').live('change',function(){ var opt = $('category :seleted').val(); document.cookie='category_name='+opt; //set cookie when user make change $.ajax({ type:'post', url : 'getcatetgory.php', data : {option : opt}, success: function(){alert('you have on category')} }); }); }); </script>
html
<select id='category'> <option value='car'>car</option> <option value='house'>house</option> <option value='sport'>sport</option> <option value='song'>song</option> <option value='phone'>phone</option> </selete>
this have done php script.
unset($_cookie['category_name']);
but still doesn't work me. please guide me
to delete cookie, must set cookie same name, path , domain, expiry date in past.
Comments
Post a Comment