Let me try to clarify what I am trying to accomplish.

First I get a list of categories from the database using ASP.
Once the user selects a category, another select box populates with
the available criteria for the user to select from. This criteria is
also from the database and it is different for every category. So once
the user selects a category, I need to use ASP to do a query on the
database to get all of the appropriate criteria for that category.

Where AJAX/jQuery comes into play is that I want the criteria select
box to be populated as soon as the user selects a category, without
having to reload the entire page.
My problem is that I don't know how to tell ASP what category the user
has selected, in turn telling ASP what criteria to show.

On Oct 30, 2:46 pm, Wizzud <[EMAIL PROTECTED]> wrote:
> There are several ways of doing it, depending on what you want your
> asp program to return.
>
> For example, assuming that your asp program will return the options as
> html, depending on the POSTed value of cat that it receives from the
> caller...
>
> var Cat = $('select.cat'); // first select
> Cat.change(function(){ // onchange event
>   // get the selected value...
>   var Opt = Cat.find('option:selected').val();
>   // clear down the current criteria, request the new options, load
> into criteria select...
>   if(Opt) $('select.crit').empty().load('yourASPprogram.asp',
> {cat:Opt});
>
> });
>
> Other alternatives are to return the entire select as html, or to
> return the option data as JSON and populate select.crit from a
> callback. Or some other alternative.
> Of course the above also assumes that select.cat is pre-populated with
> the correct options, either from the asp providing the page source, or
> from some other ajax call.
>
> On Oct 30, 3:05 pm, Snooze <[EMAIL PROTECTED]> wrote:
>
>
>
> > I am trying to make a select box that with populate depending on what
> > is selected in the select box before it. Both of these select boxes
> > need to draw information from the sql database (I have to use ASP to
> > get this information).
>
> > I've been looking at some tutorials but am overall very confused as
> > how to accomplish this.
>
> > I understand that I need to look for a change in the first select box
> > to populate the second, but I don't understand how to tell ASP to
> > query for different information.
>
> > I would like something like this:
>
> > <select name="category" class="cat">
> > <option value="value from db">label from db</option>
> > <option value="value from db">label from db</option>
> > <option value="value from db">label from db</option>
> > </select>
>
> > (I get the list of categories from a database using ASP, there is 37
> > of them but this might change.)
>
> > <select name="criteria" class="crit">
> > <option value="value from db depending on cat chosen">label from db
> > depending on cat chosen</option>
> > <option value="value from db depending on cat chosen">label from db
> > depending on cat chosen</option>
> > <option value="value from db depending on cat chosen">label from db
> > depending on cat chosen</option>
> > </select>
>
> > (I need the criteria to be drawn from the database, preferrably using
> > ASP, there is also a different number of criteria for each category.)- Hide 
> > quoted text -
>
> - Show quoted text -

Reply via email to