我在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>
感谢
答案 0 :(得分:1)
请尝试检查服务器错误日志,302用于重定向。 请确保您从ajax重定向某个错误页面。
答案 1 :(得分:1)
将此代码添加到views文件夹的头文件中:
<script>
var base_url = "<?php echo base_url(); ?>";
</script>