我正在尝试使用 URL 从浏览器加载数据。现在我正在为此使用javascript。
window.onload = function()
{
// this is URL from which i want to load data.
// myURL in this xml file is there. (myURL is running in localhost)
var url = "myURL&callback=processDATA";
loadDATA(url);
}
function loadDATA(url)
{
var headId = document.getElementsByTagName('head')[0];
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = url;
headId.appendChild(newScript);
}
function processDATA(feed) //this is function that is called after loadDATA(url).
{
// i want my XML file in feed variable.
// But this function is not called after loadDATA.
}
我不知道该怎么办。请帮我。