Prototype实战教程----7.AJAX

2016-02-19 16:35 11 1 收藏

下面图老师小编要向大家介绍下Prototype实战教程----7.AJAX,看起来复杂实则是简单的,掌握好技巧就OK,喜欢就赶紧收藏起来吧!

【 tulaoshi.com - Web开发 】

!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://www.tulaoshi.com/webkaifa/)

来源:http://www.tulaoshi.com/n/20160219/1612510.html

延伸阅读
标签: Web开发
htmlheadscript src="prototype.js"/script script function testRemove() { Element.remove("mydiv3"); } function testReplace() { Element.replace("myDiv2",'img src="200607061129268fc45.jpg&qu...
标签: Web开发
script src="prototype.js"/scriptinput type="button" id="btn" value="click" /input type="button" id="reg" value="register" /input type="button" id="unreg" value="unregister" /div id="status"/divscriptfunction ...
标签: Web开发
htmlheadtitle顶层元素/titlescript src="prototype.js"/scriptscriptvar Person=Class.create();Person.prototype={ initialize:function(){}, name:'', birthday:'', age:'', Show:function(){alert("This is "+this.name);} }; function TestPerson() { var p...
标签: Web开发
AJAX之旅(1):由prototype_1.3.1进入javascript殿堂-类的初探  还是决定冠上ajax的头衔,毕竟很多人会用这个关键词搜索。虽然我认为这只是个炒作的概念,不过不得不承认ajax叫起来要方便多了。所以ajax的意思我就不详细解释了。 写这个教程的起因很简单:经过一段时间的ajax学习,有一些体会,并且越发认识到ajax技术的强大,所以决定...
标签: Web开发
script src="prototype.js"/scriptform id="frm"div id="div1" input type="text" id="txt" name="txt" onchange="return alert('Now')"/ input type="text" id="txt2" name="txt2" / input type="button" ...

经验教程

567

收藏

51
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部