mootools 14 ajax

很久没有用过mootools,以前用的是1.1,现在升级到1.4了。下载新版下来发现AJAX的实现方法都变了,做个demo留个记号。

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>AJAXTest1--requestText</title>

    <script src="http://www.cnblogs.com/mootools/mootools-core-1[1].4.1-full-nocompat.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    window.addEvent('domready',function(){
        $('btnSent').addEvent('click',function(){
            var url='ajaxtest.aspx?v='+escape($('txtValue').value);
            var myRequest = new Request({method: 'post', url: url,onComplete:showMsg});
            myRequest.send('v='+escape($('txtValue').value));  
        });
       function showMsg(requestText){
           $('divRebackMsg').innerHTML=requestText;
       }
    });
    </script>
</head>
<body>
    <input id="txtValue" type="text" />
    <input id="btnSent" type="button" value="发送" />
    <div id="divRebackMsg"></div>
</body>
</html>

在后台page_load里输出“Hello,Mootools !”

原文地址:https://www.cnblogs.com/mimengjiangnan/p/2238971.html