<table>
    <tr>
        <td>用户名:</td>
        <td><input type="text" name="" />     </tr>
    <tr>
        <td>密码:</td>
        <td><input type="text" name="" />     </tr>
    <tr>
        <td><input type="button" value="传递数据-str" />         <td><input type="button" value="传递数据-json"></td>
    </tr>
</table>
<script>
    function submitform_str(){
            // 获取数据 
            uname1 = document.getElementById('uname1').value;
            pwd1 = document.getElementById('pwd1').value;
            // 拼接参数
            let args = 'uname=' + uname1 + '&pwd=' + pwd1;
            let xhr = new XMLHttpRequest(); 
            xhr.open('POST','http://bitto.top/post');
            // 设置请求内容的类型
            xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded') // 在open之后,send之前
            xhr.send(args);
            xhr.onload = () =>{
                console.log(xhr.responseText);
            }
        }
</script>