【问题标题】:302 Moved Temporarily in jquery ajax in codigniter302在codeigniter中的jquery ajax中临时移动
【发布时间】:2016-10-26 15:42:03
【问题描述】:

我在 codigniter 的 jquery ajax 中收到 302 Moved Temporarily 错误。请告诉我如何解决这个问题。

有时它工作正常,但有时它会出现问题。

我无法永久删除此错误。

 $.ajax({
           type: "POST",
           url: base_url+'rep/rep/appointment_nonlunch',
           data: {office_id:id},
           success: function(response){ 
                $('.imgs').attr("src", base_url+"assests/UI/dashboard/images/logo_new-1.png");
                $('#img'+id).attr("src", base_url+"assests/UI/dashboard/images/logo_white.png");
               $('div').removeClass('selected_blue_div');
               $('#'+id).addClass('selected_blue_div');
               $('#Appdetails').html(response);                   

            }
        });



<div id="offices_input" class="min-height-offcie-1 simple-bdr-btm">
                     <?php 
                     if(count($office_data) != 0){ 
                        foreach($office_data as $office){ 
                     ?> 
                        <?php if($office->lunchpro_status == 0){ ?>                 
                            <div class="padding_bottom white_bg_maging_b_5 cursor-pointer" onclick="office_detail(this.id)" id="<?php echo $office->user_id; ?>" >
                                <div class="pading-ofc-24">
                                <div class="row">   
                                    <div class="col-md-10 col-sm-9 col-xs-10">
                                      <h1><?php echo $office->office_name;?></h1>
                                      <p class="top-padding-p font_24px-color font_p_16_light"><?php echo $office->address.' '.$office->city.', '.$office->state.' '.$office->zip;?></p>
                                    </div>
                                    <div class="col-md-2 col-sm-3 col-xs-2">
                                        <div class="non-lunch-logo-img text-right">
                                            <img width="60%" alt="" class="imgs lunch-logo-15px" id="img<?php echo $office->user_id; ?>" src="<?php echo base_url();?>assests/UI/dashboard/images/logo_new-1.png">
                                        </div>
                                    </div>                      
                                </div>
                                </div>
                            </div>
                        <?php }elseif($office->lunchpro_status == 1){ ?>                        
                            <div class="padding_bottom white_bg_maging_b_5 cursor-pointer" onclick="office_nonlunch(this.id)" id="<?php echo $office->user_id; ?>" >
                                <div class="pading-ofc-24">
                                <div class="row">   
                                    <div class="col-md-12 col-sm-12 col-xs-12">
                                      <h2><?php echo $office->office_name;?></h2>
                                      <p class="top-padding-p font_24px-color font_p_16_light"><?php echo $office->address.' '.$office->zip;?></p>
                                    </div>                      
                                </div>
                                </div>
                            </div>                      
                        <?php }
                        }
                    }else{
                    ?>
                        <div class="text-center margin_top font_p_16_b">No Record Found<div></div></div>
                    <?php } ?>
                </div>

谢谢

【问题讨论】:

  • 我们在您的 AJAX 代码中找不到问题,而您也不会提供更多详细信息和服务器端代码
  • 我已经更新了代码.....
  • 此链接可能会对您有所帮助。它还谈到了302问题。 stackoverflow.com/questions/1473486/…

标签: php jquery ajax codeigniter


【解决方案1】:

请尝试检查您的服务器错误日志,302 用于重定向。 请确保您从 ajax 某些错误页面重定向请求。

【讨论】:

    【解决方案2】:

    将此代码添加到views文件夹的头文件中:

        <script>
          var base_url = "<?php echo base_url(); ?>";
       </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多