如何通过一次 MooTools Request.HTML 调用更新多个元素
有谁知道,使用 MooTools 的一次 Request.HTML 调用是否可以以某种方式更新网页中的多个元素?我当前的调用是:
var req = new Request.HTML({update: $('content')}).get('../latest_events');
这将使用“../latest_events”页面更新我页面中的内容 div。有没有办法使用同一个调用来更新“../latest_events”页面的其他 div,或者我是否必须使用单独的调用?
Does anyone know if, using one Request.HTML call from MooTools, it is possible to somehow update more than one element in a webpage? The current call I have is:
var req = new Request.HTML({update: $('content')}).get('../latest_events');
This updates the content div in my page with the "../latest_events" page. Is there a way to update other divs with the "../latest_events" page using this same call, or do I have to just use separate calls?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,在获得请求数据后,您可以对请求数据执行任何操作。只需将成功事件函数添加到您的 Request.HTML 选项中并手动处理responseText。有关 Request.HTML 可用事件的文档可在此处找到:
http://mootools.net/docs /core/Request/Request
始终记得检查 Mootools 类是否扩展了另一个类(它将在类的顶部注明)。通常,您必须沿着类树一直向上查找与该类关联的基本事件(就像 Request.HTML 的情况)。
Yes, you can do whatever you want with the request data after you've obtained it. Just add a success event function to your Request.HTML options and handle the responseText by hand. Documentation about the events available to Request.HTML is available here:
http://mootools.net/docs/core/Request/Request
Always remember to check if a Mootools class extends another (it'll be noted at the top of the class). Typically you'll have to go all the way up the class tree to find the basic events associated with the class (as is the case with Request.HTML).
您应该使用 mootools 中 Request.Queue 类的 addRequests 方法:
You should use the addRequests Method from Request.Queue Class from mootools :