Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
firefox、jquery和codeigniter的cookie问题_Jquery_Codeigniter_Firefox_Cookies - Fatal编程技术网

firefox、jquery和codeigniter的cookie问题

firefox、jquery和codeigniter的cookie问题,jquery,codeigniter,firefox,cookies,Jquery,Codeigniter,Firefox,Cookies,大家好,我对firefox上的cookie有问题,我正在使用jquery提交表单,在服务器端,控制器正在调用设置cookie,我甚至不确定这是否可能,但它似乎在chrome上运行良好,而在firefox上运行不好,但是在localhost上,它在firefox和chrome上都运行良好 这是我的密码 Jquery: 只需将此帖子标记为已回答: 在代码中,检查“url:”/vote“,”返回的url与Firefox地址栏中的url相同。是否可能site_url()返回的url与浏览器中的url不相

大家好,我对firefox上的cookie有问题,我正在使用jquery提交表单,在服务器端,控制器正在调用设置cookie,我甚至不确定这是否可能,但它似乎在chrome上运行良好,而在firefox上运行不好,但是在localhost上,它在firefox和chrome上都运行良好 这是我的密码 Jquery:


只需将此帖子标记为已回答:


在代码中,检查“url:”<?php echo site_url()?>/vote“,”返回的url与Firefox地址栏中的url相同。

是否可能site_url()返回的url与浏览器中的url不相同(即一个是example.com,另一个是www.example.com)?检查页面的来源。“url:”/vote“,”行应该显示设置cookie的url。确保它与Firefox地址栏中的URL相同您是对的,有双斜杠/,谢谢帮助:)
<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>
    $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);