5.4.10 The Ajax.Updater class

优质
小牛编辑
125浏览
2023-12-01

继承自Ajax.Request

当请求的url返回一段HTML而你想把它直接放置到页面中一个特定的元素的时候被用到。如果url的返回<script> 的块并且想在接收到时就执行它的时候也可以使用该对象。含有脚本的时候使用evalScripts 选项。

PropertyTypeKindDescription
containersObjectinstance这个对象包含两个属性:AJAX请求成功执行的时候用到containers.success , 否则的话用到containers.failure 。
MethodKindArgumentsDescription
[ctor](container, url, options)constructorcontainer:this can be the id of an element, the element object itself, or an object with two properties - object.success element (or id) that will be used when the AJAX call succeeds, and object.failure element (or id) that will be used otherwise. url: the url to be fetched, options: AJAX options创建一个用给定的选项请求给定的url的一个实例。
updateContent()instance(none)这个方法通常不会被外部调用。当响应到达的时候,被这个对象自己调用。它会用HTML更新适当的元素或者调用在insertion 选项中传入的方法-这个方法将被传入两个参数,被更新的元素和响应文本。