我很困惑为什么警报没有触发json响应。响应即将成为萤火虫。当我使用php4.4.7然后升级到php5.3.5并且现在产生此错误时,这工作正常。或者可能是我的错误。有人可以检查我的代码,看看我哪里出错了吗?如果您需要更多代码,请告诉我们。非常感谢
根据请求编码:
function test(com,grid)
{
if (com=='Delete')
{
if($('.trSelected',grid).length>0){
if(confirm('Delete ' + $('.trSelected',grid).length + ' items?')){
var items = $('.trSelected',grid);
var itemlist ='';
for(i=0;i<items.length;i++){
itemlist+= items[i].id.substr(3)+",";
}
$.ajax({
type: "POST",
dataType: "json",
url: "fileinrptdelete.php",
data: "items="+itemlist,
success: function(data){
alert("You have successfully deleted:"+"\n\n"+"Customer: "+data.customer+"\n"+"name: "+data.ref+"\n"+"boxref: "+data.boxref);
$("#flex1").flexReload();
}
});
}
} else {
alert('You have to select a row to delete.');
}
}
}
// this is from the file fileinrptdelete.php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "name: '".$ref."',\n";
$json .= "company: '".$customer."',\n";
$json .= "boxref: '".$boxref."',\n";
$json .= "total: $total\n";
$json .= "}\n";
echo $json;