Dojo xhr遇到问题?
我刚刚开始使用 Dojo,并且正在严格遵循“Hello World”教程。它在这里... http://www.dojotoolkit.org/reference-guide/快速入门/helloworld.html
我有一个像这样编码的 HTML 页面...
<html>
<head>
<title>Dojo: Hello World!</title>
<!-- SECTION 1 -->
<style type="text/css">
@import "dojoroot/dijit/themes/tundra/tundra.css";
@import "dojoroot/dojo/resources/dojo.css"
</style>
<script type="text/javascript" src="dojoroot/dojo/dojo.js"
djConfig="parseOnLoad: true"></script>
<!-- SECTION 2 -->
<script type="text/javascript">
// Load Dojo's code relating to the Button widget
dojo.require("dijit.form.Button");
</script>
</head>
<body class="tundra">
<button dojoType="dijit.form.Button" id="helloButton">
Hello World!
<script type="dojo/method" event="onClick">
dojo.xhrGet({
url: 'response.txt',
load: helloCallback,
error: helloError
});
</script>
</button>
</body>
</html>
据称,这应该会弹出位于同一目录中的“response.txt”中的文本(它在那里并且 chmod-ed 为 755。但是,单击按钮绝对不会以前没有人遇到过这个吗? 谢谢! JW
编辑:以防万一这很重要,我使用 Ubuntu 10 和 Firefox 3.6.12。
I am JUST starting with Dojo and am following the "Hello World" tutorial to the letter. It's here... http://www.dojotoolkit.org/reference-guide/quickstart/helloworld.html
I have an HTML page coded like this...
<html>
<head>
<title>Dojo: Hello World!</title>
<!-- SECTION 1 -->
<style type="text/css">
@import "dojoroot/dijit/themes/tundra/tundra.css";
@import "dojoroot/dojo/resources/dojo.css"
</style>
<script type="text/javascript" src="dojoroot/dojo/dojo.js"
djConfig="parseOnLoad: true"></script>
<!-- SECTION 2 -->
<script type="text/javascript">
// Load Dojo's code relating to the Button widget
dojo.require("dijit.form.Button");
</script>
</head>
<body class="tundra">
<button dojoType="dijit.form.Button" id="helloButton">
Hello World!
<script type="dojo/method" event="onClick">
dojo.xhrGet({
url: 'response.txt',
load: helloCallback,
error: helloError
});
</script>
</button>
</body>
</html>
Allegedly this is supposed to popup the text from "response.txt" which is in the same directory (it's there and chmod-ed to 755. Clicking the button however does absolutely nothing. Anyone encounter this before?
Thanks! JW
Edit: Just in case this matters, I am using Ubuntu 10 with Firefox 3.6.12.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有看到您在哪里定义了使用
response.txt
中的数据调用alert
的helloCallback
方法。您在问题中链接的页面有更多相关信息。I don't see where you've defined the
helloCallback
method that callsalert
using the data fromresponse.txt
. The page you linked in your question has more info on that.