Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post

    ajax post problem

    When it comes to the POST I don't know how to pass the parameters:
    Code:
    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);
    }
    Compare bible texts (and other tools):
    TheWheelofGod

  • #2
    Regular Coder
    Join Date
    Jul 2006
    Posts
    399
    Thanks
    33
    Thanked 7 Times in 7 Posts
    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
    Last edited by sybil6; 11-01-2008 at 10:27 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •