antum
asked on
PHP to return an array to SAJAX, having trouble
Hi,
I have sajax working, im new to it.
I have a PHP function:
function get_table2_data(){
return array('achievements', 'second');
}
then my javascript function that handles the data does this:
function do_table2_update_cb(table_ arr) {
alert(table_arr[0]);
for (j = 0; j < table_arr.length; j++)
{
var table2_el = document.getElementById('t able2');
table2_el.options[table2_e l.options. length] = new Option(table_arr[j], table_arr[j]);
}
}
and that first alert is just showing 'A' as if table_arr is just a string with a value of 'Array'
Any ideas how to get PHP to return a javascript array
Thanks
Ant
I have sajax working, im new to it.
I have a PHP function:
function get_table2_data(){
return array('achievements', 'second');
}
then my javascript function that handles the data does this:
function do_table2_update_cb(table_
alert(table_arr[0]);
for (j = 0; j < table_arr.length; j++)
{
var table2_el = document.getElementById('t
table2_el.options[table2_e
}
}
and that first alert is just showing 'A' as if table_arr is just a string with a value of 'Array'
Any ideas how to get PHP to return a javascript array
Thanks
Ant
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.