Hi,
I am using Ajax to send a large text box to a server script, however, when the textbox has a lot of data it fails. Is there a better way for me to do this?
Here is my code.
<script type="text/javascript">
function testmail()
{
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("results").innerHTML=xmlhttp.responseText;
}
}
var subject = "subject=" + document.getElementById('subject').value;
var testemail = "&email=" + document.getElementById('testaddress').value;
var mbody = "&body=" + document.getElementById('ha').value;
xmlhttp.open("POST","newmailer.php?" + subject + testemail + mbody ,true);
xmlhttp.send();
//alert(qs);
}
</script>
Have you checked what the reason for the failure is? This might be easier to fix than to just figure out a different route. You can start by seeing what the response from the server is - it might be some error message.