我很困惑,爲什麼警報不響應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不僅適用於您,而且適用於將來也有類似問題的其他人。外部鏈接可以被移動,修改,刪除等。通過確保相關代碼在問題中,我們確保問題(及其答案)在合理的時間段內保持有用。 –