Forum Moderators: open
I am trying to take a different approach by using Prototype.js
This framework looks great, I'm just not sure how to do a particular thing. How do I send specific array values via the Prototype.js ajax framework to another PHP file to process the data?
For instance, say I list some users with a PHP array in a table. When the user is clicked on, I want the array value (users name) of that specific user sent, I need to do it with an array. Anyone know the code to get this done?
Thank in advance!
[edited by: JohnPorier at 3:44 pm (utc) on Sep. 26, 2007]
I hope this could help u.
Javascript
<script>
var x=new Array();
var i;
x[0]="1";
x[1]="2";
i=x.join(","); //result i: 1,2
new Ajax.Request('jsarray.php', { parameters: {a:i}});
</script>
jsarray.php
<?php
$a=$_POST['a'];
$myphparray=explode(",",$a);
print_r($myphparray); //result $myphparray: array ( [0]=>1 [1]=>2 )
?>