I don't have a solution for you, but just wanted to let you
know that I'm interested in this, as well.  I'm planning
to build a real estate search interface that works with ajax
to return results to a calling page based on search choices
made by users.

My thoughts were that I would just use various functions triggered
by the check of a certain box, or a selection in a dropdown, etc.,
and all the search parameters would be scanned for their values
with any change.  I'm afraid that could get a little processor intensive,
however, with all the constant processing and changing of parameters.

I thought perhaps some kind of acceptable delay after changes might
allow users enough time to complete their search parameter changes before
triggering an ajax request.

I don't know.  I'm just in the "thinking about this" stage right now, but
will need to begin designing something in the next few weeks.

But your idea of dynamically looping a group of variables based on class
sounds interesting.  Haven't thought of that before.

I'll have to check out the web2ajax you referenced.

Rick


-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Kinsbane
Sent: Wednesday, April 08, 2009 8:26 PM
To: jQuery (English)
Subject: [jQuery] generate AJAX data based on number of select elements


Okay, so I've been working with the Facebook Like autosuggest thing:
http://web2ajax.fr/2008/02/03/facebook-like-jquery-and-autosuggest-search-en
gine/

I've adapted it to my system to make a request system for whatever
literature people want. They select something from the results, and a
div (within a form) gets populated with a li and a select box with the
quantity they want of that piece of literature.

So I want to send this request to the server via AJAX/AHAH/AJAH
whatever, but I don't know how to dynamically include the SELECT
element's values into the data part of the $.ajax... I thought if
maybe I did a var for the different data fields, I could just pass
that one var to the $.ajax data option, but again, I'm stuck trying to
figure out how I can loop through the select elements with classname
of "litqty" and add them to the data var to pass to the $.ajax
function
$(function() {
        var reqData = {
                $('.litqty').each(
                     //do something here to add it like this:
                     unique-id-or-name-of-select: value-of-select
               );
        }
        $("form#form_search_country").submit(function() {
                $.ajax('submitLitRequest.php', {
                        data: reqData
                }
        );
});

I hope that makes sense. Thanks in advance for any help !

Reply via email to