我使用此代碼加載文本文件的內容:爲什麼我無法在jQuery中加載特定的文本文件?
function go(){
//var myFile = "c:/BMCclient.log";
var myFile = "abc.html";
$.get(myFile, function(data) {
alert (data);
$('#_content').html(data);
alert('Load was performed.');
});
}
當myFile = "abc.html";
此方法成功執行,但是當我使用 myFile = "c:/BMCclient.log";
那麼它拋出一個異常:
uncaught exception: [Exception... "Component returned failure code: 0x805e000a [nsIXMLHttpRequest.open]" nsresult: "0x805e000a (<unknown>)" location: "JS frame :: file:///C:/PIC/batch/personal/web/js/jquery/jquery-1.4.2.js :: anonymous :: line 5113" data: no]
爲什麼它正在發生?
網站如何使用HTTP GET訪問個人計算機上的文件? $ .get('c:/BMCclient.log',函數(數據)無效 – RPM1984 2010-08-31 07:11:35
@RPM:如果它無效,那麼它是否應該拋出異常? – 2010-08-31 08:44:50