I am trying to send some html data to a php script using the post ajax xmlhttprequest method. But for some reason, My XHR POST REQUEST is disabled, and not all data is transferred to my doit.PHP script. However, the same html data from the textarea form is transmitted correctly through the doit.PHP script through the regular mail method of the form! could you guys help me overcome this problem and be able to pass html data via xhr request?
var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST","http://www.mysite.com/doit.php?Name=test&Id=12345",true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send("outputtext="+siteContents);
source share