The array wouldn't go at all where it should have posted
filters=arrayString¶msVar1=Value1¶msVar2=value2
it just kept posting
¶msVar1=Value1¶msVar2=value2
I have now experimented further and have created a hash which I then
passed through toJson() before posting to PHP where I used
json_decode(). So whilst the initial issue is not resolved (it
probably can't be as I don't think you can pass through an associative
array) I have managed to get my code working.
Thanks,
Paul.
On May 31, 7:02 pm, kangax <[EMAIL PROTECTED]> wrote:
> What do you mean by "cannot post to the PHP script"?
> Does it come in a wrong format?
>
> - kangax
>
> On May 31, 12:10 pm, WebbedIT <[EMAIL PROTECTED]> wrote:
>
> > Hi guys,
>
> > Been working on this most of the day and not getting anywhere fast. I
> > am working on a simple e-commerce system more specifically a filter
> > system for product listings.
>
> > What I have at present is two sets of radio buttons which are
> > generated by my productFilters() javascript function, which in turn
> > runs an Ajax.Updater, as the page loads:
>
> > Set 1: Option 1, Option 2, Option 3
> > Set 2: Option A, Option B, Option c
>
> > Each radio button has an onChange event in place which recalls the
> > productFilters() function. The function first creates an array
> > including the value of each set of radio buttons. This is where I am
> > stuck ... how do I pass my variable through to PHP in the following
> > format?
>
> > filters[set1] = value
> > filters[set2] = value
>
> > I am creating this array in the javascript no probem, but cannot post
> > it to the PHP script. Here is my javascript function.
>
> > function productFilters(params) {
> > var filters = new Array();
> > $$('#productFiltersWrap
> > input[type="radio"]').pluck('name').uniq().each(function(f) {
> > filters[f] = $$('input:checked[type="radio"][name="' + f +
> > '"]').pluck('value');
> > });
> > if (!params.evalScripts) {
> > params.evalScripts = false;
> > }
> > new Ajax.Updater(params.container, '/js/ajax.php', { parameters:
> > Object.extend ({filters: filters}, params), evalScripts:
> > params.evalScripts});
>
> > }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---