由于我的固执,常被朋友叫成"木头鸟",也许有一天"木鸟"也会飞翔... 注册 | 登陆

给Ajax.Request的onComplete事件增加自己定义的参数

Ajax.Request 是 prototype.js 最重要的一个成员。

JavaScript代码
  1. /* 以下代码来自项目中的帮助模块 */    
  2. HELP.showDefined = function(hid,objid){    
  3.     var obj = $(objid);    
  4.     //显示 正在加载中... 的信息    
  5.     obj.innerHTML = HELP.LOADING_TEXT ;    
  6.     var url = "helpmanagerview.do?act=content&defined=1&hid="+hid;    
  7.     new Ajax.Request(url,{asynchronous:true,onComplete:HELP.definedRequest(obj)});     
  8.     return false;    
  9. }    
  10. /* Ajax onComplete事件 调用函数 */    
  11. HELP.definedRequest = function(obj){    
  12.    //以下虚拟函数可以取到httpRequest对象    
  13.    return function(httpRequest){obj.innerHTML = httpRequest.responseText;};    
  14. }  

Tags: prototype

« 上一篇 | 下一篇 »

Trackbacks

点击获得Trackback地址,Encode: UTF-8

发表评论

评论内容 (必填):