• 原生js实现ajax跨域(兼容IE8,IE9)


    html设置meta标签兼容360兼容模式和IE怪异模式

    <meta http-equiv="X-UA-Compatible" content="IE=9;IE=8;IE=7;ie=edge">

    原生js跨域

    var xhr = null; // IE8/9需用window.XDomainRequest兼容
    if (window.XDomainRequest) {
        xhr = new XDomainRequest();
        xhr.onload = function () {
            console.log(xhr.responseText);
        }
        xhr.open("get", 'http://test.aa.com');
        xhr.send();
    } else {
        xhr = new XMLHttpRequest();
        // 前端设置是否带cookie
        xhr.withCredentials = true;
        xhr.open('post', 'http://test.aa.com', true);
        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        xhr.send('user=admin');
    
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status == 200) {
                console.log(JSON.parse(xhr.responseText).name);
            }
        };
    }
  • 相关阅读:
    Analog power pin UPF defination
    动态功耗计算
    静态功耗 计算
    Innovus 对multibit 的支持
    P &R 12
    P & R 11
    power-plan如何定
    P & R 10
    P & R 9
    线程基础
  • 原文地址:https://www.cnblogs.com/zt123123/p/8878288.html
Copyright © 2020-2023  润新知