Hi,
I can pass an array through jquery ajax.

var regSubCodeArray = new Array();
var temp = 9;
var i;

for(i=0;i<temp;i++)
	{
		subname = 'sub'+i;
		subcode = 'sub_code'+i;
		subcredit = 'sub_credit'+i;
		regSubCodeArray[i] = document.getElementById(subcode).innerText;

	}
 $.ajax({
		url: "testArray.php",	
		type: "GET",		
		data: "page="+regSubCodeArray,	
		cache: false,
		success: function (html) {	
		
			$('#ttl').html(html);	
		}		
	});

In 'testArray.php', i did the following

echo $_GET['page'];

It prints all the data of the array. But i want to access each data using some foreach loop in my testArray.php page.

Can any-one help me??

What does $_GET['page'] look like? If you use a separator then you can use explode() to separate it.

What does $_GET['page'] look like? If you use a separator then you can use explode() to separate it.

My regSubCodeArray contains '1','2','3'......

for

echo $_GET['page'];

it prints the following

1,2,3,4,....
  all are separated by a comma
$regSubCodeArray = explode(',', $_GET['page']);
print_r($regSubCodeArray);
$regSubCodeArray = explode(',', $_GET['page']);
print_r($regSubCodeArray);

thnxx man...it worked...:)

Please mark this thread solved.

Please mark this thread solved.

I have clicked the Mark this Thread as Solved under Has this thread been answered? but still its showing Discussion Thread
Unsolved

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.