0
i'm新手,有xhrGet一個問題,它返回空的響應數據。道場xhrGet在道場返回空數據
function test1(){
// Using dojo.xhrGet, as very little information is being sent
dojo.xhrGet({
// The URL of the request
url: 'http://www.dojotoolkit.org/documentation/tutorials/1.6/ajax/demo/get-content.php',
// The success callback with result from server
load: test2,
// The error handler
error: function(errorMessage) {
// Do nothing -- keep old content there
alert("Error Message: " + errorMessage);
}
});
}
function test2(result, ioArgs){
alert(result);
dojo.byId("tContent").innerHTML += result;
}
我debuged此代碼,結果是空的始終。任何人都可以說我,我做錯了什麼?
在此先感謝
低糜
嗨,我必須從其他網站獲取數據。我現在發現我必須使用「跨站點XHR插件」。我是否正確? – user864980
@ user864980是的,你可能是。您可能還想在JSONP上進行搜索(填充的JSON)。各種技巧取決於您的服務器/服務以及它如何呈現數據。 – Frode
你能給我一個簡單的例子(f.e.加載任何HTTP內容),請。我發現了任何代碼片斷,但它不工作... – user864980