我正在尝试 dojo 教程中的一些示例代码。我有
<button dojoType="dijit.form.Button" id="helloButton">
Test
<script type="dojo/method" event="onClick">
dojo.xhrGet({
url: 'response.txt',
load: testCallback,
error: testError
});
alert("getting thru");
</script>
</button>
当我单击按钮时,我收到错误回调已运行,但我不明白为什么。
这是测试回调
function testCallback(data, ioArgs)
{
alert(data);
}
我有一个名为response.txt 的文件,它与index.html 位于同一文件夹中。我真的很困惑!
有什么建议吗?
谢谢
莹
最佳答案
我重新启动了计算机,一切似乎都正常。幸运的是,我无法重现该错误。回顾一下:
1) 设置response.txt的权限
2) 使用 netstat -an 确保端口 8000 已打开
感谢大家的参与!
关于javascript - 道场问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1441497/