JavaScript 实现 POST 请求:发送黑名单词语至 API
function postBlackWords(blackWords) { var xhr = new XMLHttpRequest(); var url = 'http://103.215.36.226:8007/webms.php?c=common&a=blackWords'; var params = 'blackWords=' + encodeURIComponent(blackWords); xhr.open('POST', url, true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) { console.log(xhr.responseText); } }; xhr.send(params); }
原文地址: https://www.cveoy.top/t/topic/qjFX 著作权归作者所有。请勿转载和采集!