開啟檔案
if (xmlhttp)
{
xmlhttp.open("GET", "XXX.txt", true); //是否進行非同步呼叫
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readystate == 4) //0未初始化 1正在載入 2己載入 3互動中 4完成
{
if(xmlhttp.status == 200) //只允許成功時印出資訊
{alert(xmlhttp.responseText);}
else{alert('錯誤發生');}
}
}
xmlhttp.send(null);
}
{
xmlhttp.open("GET", "XXX.txt", true); //是否進行非同步呼叫
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readystate == 4) //0未初始化 1正在載入 2己載入 3互動中 4完成
{
if(xmlhttp.status == 200) //只允許成功時印出資訊
{alert(xmlhttp.responseText);}
else{alert('錯誤發生');}
}
}
xmlhttp.send(null);
}