• ajax跨域请求操作实例


    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>JS</title>
        <style>
            #box{
                600px;
                height:200px;
                padding:20px;
                border:1px solid #999;
            }
        </style>
        
    </head>
    <body>
        <h1>ajax跨域请求操作实例</h1>
        <hr>
        <button onclick="loadHtml()">加载</button>
        <div id="box"></div>
        <script>
            //http://127.0.0.1/s32/JS10_Jquery01/lessson/2.php
            function loadHtml(){
                //创建script
                var script = document.createElement("script");
                script.src = "http://127.0.0.1/s32/JS10_Jquery01/lessson/2.php";
                //把script元素追加到body
                document.body.appendChild(script);
                //删除
                document.body.removeChild(script);
            }
            
            //定义函数
            function addHtml(data){
                document.getElementById('box').innerHTML = data;
            }
        </script>
    </body>
    </html>
  • 相关阅读:
    wenbao与分治
    wenbao与贪心
    wenbao与高精度
    wenbao与FFT
    wenbao与卡特兰数
    wenbao与类
    wenbao与取整函数
    wenbao与字符串转化
    wenbao与scanf
    wenbao与数字与字符串
  • 原文地址:https://www.cnblogs.com/shanyansheng/p/5060825.html
Copyright © 2020-2023  润新知