i have a problem need all you guys help me.i set the cookie with javascript when the user make change to the select tag in html code and clear i want to clear it.
* if in php script i just need to clear or delete it , but if in jquery script i need to delete the old one immediately and set a new one of cookie value when the user make change to select tag. let's see the script below.
jquery script
<script type="text/javascript">
$(function(){
$('#category').live('change',function(){
var opt = $('category :seleted').val();
document.cookie='category_name='+opt; //set the cookie when user make change
$.ajax({
type:'POST',
url : 'getcatetgory.php',
data : {option : opt},
success: function(){alert('you have successfully get 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 is i have done with php script.
unset($_COOKIE['category_name']);
but it still doesn't work for me. please guide me