!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"html head titleAjax/title script type="text/javascript" language="javascript" src="prototype.js" /script script type="text/javascript" language="javascript" function test() { var myAjax = new Ajax.Request( 'http://www.wanfangdata.com.cn', { method: 'get', onComplete: showResponse } ); } function showResponse(response) { $('divResult').innerHTML = response.responseText; } var handle = { onCreate: function() { Element.show('loading'); }, onComplete: function() { if (Ajax.activeRequestCount == 0) { Element.hide('loading'); } } }; Ajax.Responders.register(handle);//把handle注册到全局的Ajax.Responders,Ajax.Responders用来维护一个正在运行的Ajax对象列表 /script /head body input type="button" value="click" onclick="test()" / div id="divResult" /div div id='loading' style="display:none" img src="loading2.gif"Loading /div /body/html(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/webkaifa/)
Prototype实战教程----7.AJAX
下面图老师小编要向大家介绍下Prototype实战教程----7.AJAX,看起来复杂实则是简单的,掌握好技巧就OK,喜欢就赶紧收藏起来吧!