Hi there, I’m trying to send multiple post vars to a php script but having a good bit of trouble. Here’s the code:
[CODE]var titleText = document.getElementById(“notesTitle”).value; //get the title
var notesText = document.getElementById(“notesText”).innerHTML; // get the content
titleText = encodeURIComponent(titleText); //uri escape title
notesText = encodeURIComponent(notesText); //uri escape text
titleText = “title=”+titleText; //set them up as post variables
notesText = “notes=”+notesText;
var postArray = new Array(2); //put them in an array that I will hand to the postAjax function
postArray[0] = titleText;
postArray[1] = notesText;
var responseText = postAjax(‘/newSchool/php/notesSubmitter.php’,postArray,’writingPlace’);
function postAjax(file,postvar,div)
{
var httpObject = getHttpObject();
httpObject.open(‘POST’,file,false);
for(var i=0;i<postvar.length;i++)
{
httpObject.send(postvar[i]);
}
if(httpObject.status == 200)
{
var str = httpObject.responseText;
}
else
{
document.write(“404 Not Found. There may have been an error in the request”);
}
return str;
}
When I run it I get an error entitled “INVALID_STATE_ERR: DOM Exception 11”. Does anyone know what I’m doing wrong (I understand I might have done all this completely wrong, sorry if I did)?