您可以通过以下方式提交表单
Ajax:
function submitFormAjax() { let xmlhttp= window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.onreadystatechange = function() { if (this.readyState === 4 && this.status === 200) alert(this.responseText); // Here is the response } let name = document.getElementById('name').innerHTML; let email = document.getElementById('email').innerHTML; xmlhttp.open("GET","your_url.php?name=" + name + "&email=" + email, true); xmlhttp.send();}此示例正在使用
GET,但您也可以使用
POST:
xmlhttp.open("POST","your_url.php",true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlenpred");xmlhttp.send("name=" + name + "&email=" + email);注意:
完成
submitFormAjax()后,您必须在
validateFormOnSubmit没有错误的情况下致电,这里:
if (reason.length == 0) { // Show some loading image and submit form submitFormAjax();} else { return false;}


