soarli

通过Ajax以表单的形式提交多变量
通过Ajax以表单的形式提交多变量键值对: function AJAX(b64) { ...
扫描右侧二维码阅读全文
21
2022/01

通过Ajax以表单的形式提交多变量

通过Ajax以表单的形式提交多变量键值对:

        function AJAX(b64) {
            var xmlhttp;
            if (window.XMLHttpRequest) {
                // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                xmlhttp = new XMLHttpRequest();
            } else {
                // IE6, IE5 浏览器执行代码
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
                }
            }
            xmlhttp.open("POST", "/try/ajax/demo_post.php", true);
            xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            xmlhttp.send(
                "test=" + encodeURIComponent('123456') +
                "&b64value=" + encodeURIComponent(b64)
            );
        }

参考文章:

https://www.runoob.com/ajax/ajax-xmlhttprequest-send.html

https://www.itbaoku.cn/post/49055.html

https://blog.csdn.net/KingJin_CSDN_/article/details/53156864

https://blog.csdn.net/qq_34549618/article/details/78480128

https://www.cnblogs.com/han-1034683568/p/7199168.html

https://www.w3cschool.cn/ajax/ajax-uy1r2or1.html

最后修改:2022 年 01 月 21 日 03 : 12 AM

发表评论