Having an issue with .serialize() - it's not grabbing the values for
the names of the elements, and it only
does it for those elements that are already on the page when it's
loaded. It's not returning in the serialized string
any of the SELECT elements that get added when someone picks a piece
of literature.

Is it really this hard to get something going? :(

On Apr 10, 10:56 am, Kinsbane <kinsb...@gmail.com> wrote:
> Hi Ricardo,
>
> Thanks! Will this serialize everything about the element with class of
> litqty? I will give it a shot.
>
> I'm sorry for not explaining to others in detail about what I need.
> Here it is:
> Each piece of literature that gets selected returns an ID telling us
> where to pull it from (documents or datasheets)
> and a unique alpha-numeric string called our control number. This is
> what the ID attribute and the NAME attribute in the select element
> holds.
> This is what I need to add to the reqData variable - I need the NAME
> of the ID of the select itself, along with the value of that select,
> because the ID tells us what we need to print
> out and ship.
>
> Thanks everyone!
>
> On Apr 10, 9:20 am, Ricardo <ricardob...@gmail.com> wrote:
>
> > You can't return anything rom $().each, and object literals are not
> > scope blocks, that won't work, it would have to be something like
> > this:
>
> > $(function() {
> >         //serialize() creates a query string from the form elements
> > provided
> >         var reqData = $('.litqty').serialize();
>
> >         $("form#form_search_country").submit(function() {
> >               $.post('submitLitRequest.php', reqData);
> >               return false;
> >         });
>
> > });
>
> > On Apr 9, 5:02 pm, "mattimus5...@gmail.com" <mattimus5...@gmail.com>
> > wrote:
>
> > > Ok I see your code from the above post now.
>
> > > var reqData = {
> > >                 $('select.litqty').each(
> > >                      $(this).attr('name') : $(this).val();
> > >                );
> > >         }
> > > This would get the name and value of each select.litqty
> > > Is this what you are trying to achieve??
>
> > > On Apr 9, 3:48 pm, "mattimus5...@gmail.com" <mattimus5...@gmail.com>
> > > wrote:
>
> > > > You are just trying to get the value of the select box and only the
> > > > select box???
>
> > > > So you have something like
> > > > <ul class="books">
> > > > <li> Book 1 <select class="litqty"><option...... /></select></li>???
> > > > <li> Book 2 <select class="litqty"><option...... /></select></li>
> > > > <li> Book 3 <select class="litqty"><option...... /></select></li>
> > > > <li> Book 4 <select class="litqty"><option...... /></select></li>
> > > > </ul>
>
> > > >  What do you need reqData to look like?

Reply via email to