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
-~----------~----~----~----~------~----~------~--~---