我很困惑,为什么警报不响应json响应。反应正在进入萤火虫。当我使用php4.4.7时,这是工作正常,但后来升级到php5.3.5,现在产生这个错误。或者可能是我的错误。有人可以检查我的代码,看看我哪里出错了吗?如果您需要更多代码,请告诉我。非常感谢警报不响应json响应
代码在这里为每个请求:
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;
实时链接对于一个问题来说是一个很好的*附件*,但也总是在问题*中发布相关的代码*。两个原因。 1.人们不应该遵循链接来帮助你。 2. StackOverflow不仅适用于您,而且适用于将来也有类似问题的其他人。外部链接可以被移动,修改,删除等。通过确保相关代码在问题中,我们确保问题(及其答案)在合理的时间段内保持有用。 –