set cookie through jquery in php
<script type="text/javascript">
$(document).ready(function() {
$("#currency").change(function() {
var id = $(this).val();
$.ajax({
url: 'current.php',
type: 'POST',
data:{'id':$(this).val()},
success: function(data)
{
location.reload();
}
});
});
});
</script>
current.php
<?php
$id=$_POST['id'];
setcookie("to",$id);
?>
$(document).ready(function() {
$("#currency").change(function() {
var id = $(this).val();
$.ajax({
url: 'current.php',
type: 'POST',
data:{'id':$(this).val()},
success: function(data)
{
location.reload();
}
});
});
});
</script>
current.php
<?php
$id=$_POST['id'];
setcookie("to",$id);
?>