通过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
版权属于:soarli
本文链接:https://blog.soarli.top/archives/603.html
转载时须注明出处及本声明。