Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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("POST","your_url.php",true);
- xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
- xmlhttp.send("name=" + name + "&email=" + email);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement