...

View Full Version : ajax post problem



gilgalbiblewhee
10-30-2008, 11:30 PM
When it comes to the POST I don't know how to pass the parameters:

function sendDelCheck(){
var url = "delCheck.php";
/*these are supposed to be the paramters
tableName=game1
&CheckAll=Check+All
&selectVerse0=game1_1
&tableName=game2
&tableName=game3
&tableName=game4
&tableName=game5
&submit=Delete
*/
var params = "tableName="+document.getElementsByName('tableName').value+"&submit="+document.getElementById('deleteButton').value;
http.open("POST", url, true);

//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(params);
}

sybil6
11-01-2008, 02:45 PM
i believe you are having a problem with serializing your data before sending it :
document.getElementsByName('tableName').value, this gives you a collection but doesnt give ajax the access to each variable value. maybe you should try something like:document.getElementsByName('tableName')[0].value....[1].value...etc



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum