After trying many methods I found that sending it s json to php and using
php to json_decode it is the best way of moving arrays accross languages,
Alex Mcauley
http://www.thevacancymarket.com
----- Original Message -----
From: "T.J. Crowder" <[email protected]>
To: "Prototype & script.aculo.us" <[email protected]>
Sent: Thursday, May 13, 2010 7:25 AM
Subject: [Proto-Scripty] Re: how to pass array to .php script?
Hi,
This may not be it, but: PHP has special handling of arrays, which is
triggered by your using a field name ending with "[]".
So for instance, if you have this:
new Ajax.Request('/ajax/name_of_function.php', {
parameters: {foo: ["one", "two", "three"]},
method: 'post'
}
try doing this:
new Ajax.Request('/ajax/name_of_function.php', {
parameters: {"foo[]": ["one", "two", "three"]},
method: 'post'
}
to tell PHP to apply its magic. (I've added [] after the field name.
Note the quotes; otherwise it would be a syntax error.)
If that's not it, I'd suggest creating a minimal self-contained test
page and posting that.[1]
[1] http://proto-scripty.wikidot.com/self-contained-test-page
HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com
On May 12, 10:02 pm, Max <[email protected]> wrote:
Hi all.
I'm new in work with prototype. Please,help me.
I need to pass an array to the .php script. I'm using such code:
new Ajax.Request('/ajax/name_of_function.php', {
parameters: {name_of_perameter: name_of_array},
method: 'post',
But as a result I get in $_POST['name_of_perameter'] only the last
element of array.
Please, explain me - how I can do it correctly
Thanks
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group
athttp://groups.google.com/group/prototype-scriptaculous?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.
--
You received this message because you are subscribed to the Google Groups "Prototype
& script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.