帮助,我需要更改此代码以支持远程域访问:
document.write(url);
var http = getHTTPObject();
http.open("GET", url, true);
http.onreadystatechange = function() {
if (http.readyState == 4) {
parseData(http.responseText);
}
}
http.send(null);
Run Code Online (Sandbox Code Playgroud)
在你的js中:
function goRemote(url) {
var script = document.createElement("script");
script.src=url;
document.body.appendChild(script);
}
function parseDate(json) {
// do your fun here.
}
Run Code Online (Sandbox Code Playgroud)
在你返回的js中:
parseData({"foo": "bar"});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2558 次 |
| 最近记录: |