js post方式提交表单有两种办法,1:AJAX提交 2:在JS里拼出一个form,然后submit
第二种办法的代码
//这个主要是解决给password MD5
var email = 'email'; var pwd = 'password'; var postForm = document.createElement("form");//表单对象 postForm.method="post" ; postForm.action = 'login.jspx' ; var emailInput = document.createElement("input") ; //email input emailInput.setAttribute("name", "email") ; emailInput.setAttribute("value", email); postForm.appendChild(emailInput) ; var pwdInput = document.createElement("input");// password input pwdInput.setAttribute("name","password"); pwdInput.setAttribute("value",pwd); postForm.appendChild(pwdInput); document.body.appendChild(postForm) ; postForm.submit() ; document.body.removeChild(postForm) ;