我有一個頁面顯示錶中的XML信息。 XML文件是服務器端,我使用PHP來使用下拉框來獲取文件名和數據。 JSON用於將下拉列表中的名稱和DOM發送到XML中。在所有瀏覽器中都能正常工作。PHP IE9 XML問題
我的添加條目功能存在問題。當我在Chrome或Firefox中添加條目時,它會在下次選擇該表時顯示。但它在IE9中不起作用。這些條目被添加到XML文件,但要在IE中查看這些更改,我必須打開一個新的選項卡。簡單刷新不起作用。要在此腳本重定向我用頭功能:
header('Location: ./client2.html');
有什麼需要在這裏添加的IE瀏覽器還是有一個問題在其他地方。我已經添加了在選擇文件時獲取數據的php。
ini_set('display_errors',1);
error_reporting(E_ALL);
/* gets the selected file to use to return data */
$xml_filename = './XML/'.$_REQUEST['file'];
$xml = simplexml_load_file($xml_filename);
/* gets the root of the selected file */
$rootname = $xml->getName();
/* gets the children in that root */
$children = $xml->children();
$firstchild = $children[0];
// gets the table headings
$data = '{"headings":[';
foreach ($firstchild as $elem)
{
$data = $data.'"'.$elem->getName().'",';
}
// removes trailing ','
$data = substr_replace($data,"",-1);
$data = $data.'],';
// gets the cell values
$data = $data. '"vals":[';
foreach ($children as $child)
{
$data = $data.'[';
foreach ($child as $elem => $vals)
{
$data = $data.'"'.$vals.'",';
}
$data = substr_replace($data,"",-1);
$data = $data.'],';
}
// removes trailing ','
$data = substr_replace($data,"",-1);
$data = $data.']}';
/* sends created JSON string back to client */
echo $data;
聽起來像一個緩存問題? – 2012-02-11 18:43:16
這就是我的想法。你知道有什麼方法不允許瀏覽器在頁面上緩存嗎? – 2012-02-11 18:49:15
原來這是一個緩存問題。我可以解決這個問題的唯一方法是將'.ajaxSetup({cache:false})'放在文檔就緒的Ajax中。 – 2012-02-16 13:42:35