Hi guys I have a problem with cookies on firefox I’m submitting a form using jquery and on server side the controller am calling sets a cookie, i was not even sure if that possible but it seems working fine with chrome and not on firefox, however on localhost it works fine for both firefox and chrome
here is my code
Jquery:
<script type="text/javascript">
$("#vote-button").click(function() {
$('.ui-button').fadeOut();
/*var dataString = 'vote='+ vote + '&id=' + id + '&ip=' + ip + '&code=' + code;*/
$.ajax({
type: "POST",
url: "<?php echo site_url()?>/vote",
data: $('#hate-form').serialize(),
success: function() {
$('.vote-box').html("<p> Thanks for voting :) </p>").fadein("slow");}
});
return false;
});
</script>
and this in my controller Vote:
$this->load->model('site_model');
$this->site_model->add_vote($id,$vote,$inside);
$cookname ='motriba_'.$id;
$current_time = time();
$exp = $current_time + 86400 - ($current_time % 86400); //midnight time
setcookie($cookname,$id,$exp);
Just to mark this post as answered:
In your code, check that ‘url: “< ?php echo site_url()?>/vote”,’ returns the same URL as the URL in Firefox address bar.