我遇到一个问题,当我从producion服务器请求json数据时出现500错误,尽管它在本地服务器上工作正常。只要我在firefox中使用firebug检查php代码和错误,php代码工作正常。两台服务器都返回正确的值,但仅在prodction服务器中,我得到500错误。我应该如何处理它?</ p>
php代码:
function ajax_get_select(){
$this->layout = '';
$this->autoRender = false;
$ret = array('result' => 'NG');
$cate_data = $this->Category->find('all',array(
'fields'=>array(
'Category.id',
'Category.name',
),
'conditions'=>array(
'Category.parent_category_ids'=>$_POST['id'],
'Category.publish_flag'=>1,
),
'order'=>array('Category.rank'=>'DESC')
));
if(!empty($cate_data)){
foreach($cate_data as $cate){
$ret['list'][] = array('id'=>$cate['Category']['id'],'name'=>$cate['Category']['name']);
}
$ret['result'] = 'OK';
}
echo json_encode($ret);
return;
}
Jquery代码:
function call_ajax_select(id,next){
var zero_next = '0' + next;
zero_next = zero_next.slice(-2);
$.ajax({
type: 'POST',
async: false,
url: '/xxxxxx/ajax_get_select/',
data: {id:id},
dataType: 'json',
}).done(function(json, status) {
if(json['result'] === "OK") {
var select = $('#list_No' + zero_next);
select.empty();
if(next%4!=0){
select.append($('<option />').val('').html((next%4) + 'th category'));
}else{
select.append($('<option />').val('').html('4th category'));
}
if(json['list']){
for(var i=0;i<json['list'].length;++i){
select.append($('<option />').val(json['list'][i]['id']).html(json['list'][i]['name']));
}
}else{
}
} else {
if(next/4 >3){
}else if(next/4 >2){
$(".box04").show();
}else if(next/4 >1){
$(".box03").show();
}else{
$(".box02").show();
}
}
}).fail(function(xhr, status) {
});
}
响应标题:
Connection :keep-alive
Content-Length :773
Content-Type :text/html; charset=UTF-8
Date :Fri, 16 Oct 2015 08:38:06 GMT
P3P :CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Server :Apache
在本地服务器中,Connection是“关闭”。
我需要别人的帮助