ivanhuk 0 Newbie Poster

I've an HTML table that I iterate through and grab an id column for every row that is checked. Jquery puts these values into an array that is then supposed to be passed to php post through an ajax function. The array is fine through HTTP post and Response (using Firebug). However the php post shows a null array when I do a var_dump. So in Jquery, http post and response both have populated arrays, but php's post is null. What am I doing wrong?

HTTP Post:
idlist[] 61
idlist[] 62
Source
idlist%5B%5D=61&idlist%5B%5D=62

HTTP: Response:
array(1) {
["idlist"]=>
array(2) {
[0]=>
string(2) "61"
[1]=>
string(2) "62"
}
}

Jquery:

$(document).ready(function() {
	$("#deletebut").click(function() {
		var msg = "You are about to delete the checked rows of the \ndatabase on the left.  This will permanently erase the checked \nnames and emails. Do you want to go ahead?";
		var r = confirm(msg);
		var idlist = [];
		var counter = 0;
		if(r==true) {
			$("#results tr").each(function() {
				if($(this).find("#checkbox").is(':checked')) {
					idlist.push($(this).find(".idcell").html());
					counter = counter+1;
				} 
			});
			$.ajax({
				data:{'idlist':idlist},
				type:'POST',
				cache:false,
				url:"http://localhost/school/desi/maintain/indexdelete.php",
				success: function(result,status) {
					if(!result) {
						alert("Response Status is: "+status);
					} else {
						alert("Response Succesful, Received: "+idlist);
					}}	
			});
		} else {
			alert("You have canceled, Nothing will be deleted.");
		}
	});	
});

php:

var_dump($_POST);

php result: array(0) { }

Any help with this would be much appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.