Ajax.Request 是 prototype.js 最重要的一个成员。
JavaScript代码
- /* 以下代码来自项目中的帮助模块 */
- HELP.showDefined = function(hid,objid){
- var obj = $(objid);
- //显示 正在加载中... 的信息
- obj.innerHTML = HELP.LOADING_TEXT ;
- var url = "helpmanagerview.do?act=content&defined=1&hid="+hid;
- new Ajax.Request(url,{asynchronous:true,onComplete:HELP.definedRequest(obj)});
- return false;
- }
- /* Ajax onComplete事件 调用函数 */
- HELP.definedRequest = function(obj){
- //以下虚拟函数可以取到httpRequest对象
- return function(httpRequest){obj.innerHTML = httpRequest.responseText;};
- }

