原型 Ajax 更新不起作用
我正在使用 Prototype,同时使用 pylons 框架并尝试进行 Ajax 调用。
我的 html 如下所示:
<form method="POST" action = "javascript:void(0)" onsubmit = "new Ajax.Updater('graph','/saffron_main/click_out_display'); ">
<label for="tids">Select Relevant Tids</label>
<select id="tids" multiple="multiple" name="tids" title="Tids">
<option>1</option>
<option>2</option>
</select>
<p><input class = "button" type="submit" name="submit" value="submit" /></p>
</form>
<div id = "graph">
</div>
我可以看到我的控制器被调用,并向 /saffron_main/click_out_display 发出了 http 请求。一切看起来都工作正常。唯一的问题是 div 永远不会被填充。我正在拔出我的头发试图弄清楚这个问题,任何帮助将不胜感激!谢谢!
I am working with Prototype while using the pylons framework and trying to make an Ajax call.
Here is what my html looks like:
<form method="POST" action = "javascript:void(0)" onsubmit = "new Ajax.Updater('graph','/saffron_main/click_out_display'); ">
<label for="tids">Select Relevant Tids</label>
<select id="tids" multiple="multiple" name="tids" title="Tids">
<option>1</option>
<option>2</option>
</select>
<p><input class = "button" type="submit" name="submit" value="submit" /></p>
</form>
<div id = "graph">
</div>
I can see that the my controller gets called and a http request gets made to /saffron_main/click_out_display. Everything looks like it is working properly. The only problem is the div never gets populated. I am pulling out my hair trying to figure this one out and any helps would be greatly appreciated! Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果在实例化
Ajax.Updater
后将return false;
放入 onsubmit 中,会发生什么情况?为什么-
目前默认情况下会返回 true,并且页面可能会被回发,而不是通过 Ajax
What happens if you put a
return false;
inside the onsubmit after you instantiate anAjax.Updater
?Why -
It currently would be returning true by default and the page may be getting posted back, not via Ajax