这只发生在lighthttpd而不是apache或其他任何事情。代码实际运行,但我没有得到回复在ajax或通过常规帖子。
请求/响应
Request URL:http://awcpos.no-ip.org/index.php/items/save/529
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:application/json, text/javascript, */*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:250
Content-Type:application/x-www-form-urlencoded
Cookie:phppos=a%3A4%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%2269a65a5b0f1df2f41289c3feb63212d1%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A14%3A%2272.230.180.236%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A50%3A%22Mozilla%2F5.0+%28Macintosh%3B+Intel+Mac+OS+X+10_6_8%29+App%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1312596392%3B%7D74087fe11a84808da34458abdb0b7f0d
Host:awcpos.no-ip.org
Origin:http://awcpos.no-ip.org
Referer:http://awcpos.no-ip.org/index.php/items
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1
X-Requested-With:XMLHttpRequest
Form Dataview URL encoded
item_number:
name:Test
category:Test
supplier_id:
cost_price:1.00
unit_price:2.00
tax_names%5B%5D:GST
tax_percents%5B%5D:
tax_cumulatives%5B%5D:0
tax_names%5B%5D:
tax_percents%5B%5D:
quantity:10
reorder_level:1.00
location:
description:
submit:Submit
Response Headersview source
Content-Length:0
Content-type:text/html
Date:Sat, 06 Aug 2011 02:13:25 GMT
Server:lighttpd/1.4.29
X-Powered-By:PHP/5.3.6
代码:(这是json回来的)
function save($item_id=-1)
{
$item_data = array(
'name'=>$this->input->post('name'),
'description'=>$this->input->post('description'),
'category'=>$this->input->post('category'),
'supplier_id'=>$this->input->post('supplier_id')=='' ? null:$this->input->post('supplier_id'),
'item_number'=>$this->input->post('item_number')=='' ? null:$this->input->post('item_number'),
'cost_price'=>$this->input->post('cost_price'),
'unit_price'=>$this->input->post('unit_price'),
'quantity'=>$this->input->post('quantity'),
'reorder_level'=>$this->input->post('reorder_level'),
'location'=>$this->input->post('location'),
'allow_alt_description'=>$this->input->post('allow_alt_description'),
'is_serialized'=>$this->input->post('is_serialized')
);
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
$cur_item_info = $this->Item->get_info($item_id);
if($this->Item->save($item_data,$item_id))
{
//New item
if($item_id==-1)
{
echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_adding').' '.
$item_data['name'],'item_id'=>$item_data['item_id']));
$item_id = $item_data['item_id'];
}
else //previous item
{
echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_updating').' '.
$item_data['name'],'item_id'=>$item_id));
}
$inv_data = array
(
'trans_date'=>date('Y-m-d H:i:s'),
'trans_items'=>$item_id,
'trans_user'=>$employee_id,
'trans_comment'=>$this->lang->line('items_manually_editing_of_quantity'),
'trans_inventory'=>$cur_item_info ? $this->input->post('quantity') - $cur_item_info->quantity : $this->input->post('quantity')
);
$this->Inventory->insert($inv_data);
$items_taxes_data = array();
$tax_names = $this->input->post('tax_names');
$tax_percents = $this->input->post('tax_percents');
$tax_cumulatives = $this->input->post('tax_cumulatives');
for($k=0;$k<count($tax_percents);$k++)
{
if (is_numeric($tax_percents[$k]))
{
$items_taxes_data[] = array('name'=>$tax_names[$k], 'percent'=>$tax_percents[$k], 'cumulative' => isset($tax_cumulatives[$k]) ? $tax_cumulatives[$k] : '0' );
}
}
$this->Item_taxes->save($items_taxes_data, $item_id);
}
else//failure
{
echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_error_adding_updating').' '.
$item_data['name'],'item_id'=>-1));
}
}
答案 0 :(得分:0)
没有启用导致问题的Json