Ajax基础

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>12</title>
    <script src="ajax.js"></script>
    <script>
        window.onload=function () {
            var oBtn=document.getElementById('btn1');
            oBtn.onclick=function(){
                ajax('aaa.txt', function (str) {
                    alert(str);
                },function(){
                    alert('失败');
                });
            }
        }
    </script>
</head>
<body>
<input id="btn1" type="button" value="读取"/>

</body>
</html>

 

posted @ 2016-11-29 16:44  缘琪梦  阅读(130)  评论(0)    收藏  举报