[jQuery] Re: removeClass() fires before anything else in a series of functions when I need it to fire last.

2010-01-05 Thread Kinsbane
er, jeez I'm sorry - i don't know how to format code on Google Groups :
(

On Jan 5, 2:21 pm, Kinsbane  wrote:
> So, there's a main column of content and to the left of the main
> column is an A element that is absolutely positioned.
>
> I have an announcement system that when there's an active
> announcement, a box is rendered above the main column, pushing the
> main column down. However, the A element that is absolutely positioned
> stays where it is.
>
> I added code to check for an active announcement and add a class to
> the A element so it'll keep it positioned alongside the left-border of
> the main column.
>
> When a user closes the announcement box, it fades out, and the main
> column moves back up to fill the space - but the positioned A element
> does not follow. I then added code to the function I had to fade out
> the box and save a cookie to show the user had closed the active
> announcement box which removed the active-announcement class I had PHP
> add to the A element.
> The problem is, even though the removeClass() function is last in the
> series of functions, it fires first - the positioned A element moves
> up to where it should be BEFORE the active announcement box fades out.
>
> How can I change this so that the positioned A element has its class
> removed after the other two things have taken place?
>
> Here's the jQuery code I have:
> [code]
> $("#close-notice").click(function(){
>
>                                         $("#notice").fadeOut(800);
>                                         createCookie('t3d_notice', 
> 't3dnotice_
> >', 365);
>
>                                         
> $("#notice-tab").removeClass('active-notice');
>
>                                 }
>                                 );
> [/code]


[jQuery] removeClass() fires before anything else in a series of functions when I need it to fire last.

2010-01-05 Thread Kinsbane
So, there's a main column of content and to the left of the main
column is an A element that is absolutely positioned.

I have an announcement system that when there's an active
announcement, a box is rendered above the main column, pushing the
main column down. However, the A element that is absolutely positioned
stays where it is.

I added code to check for an active announcement and add a class to
the A element so it'll keep it positioned alongside the left-border of
the main column.

When a user closes the announcement box, it fades out, and the main
column moves back up to fill the space - but the positioned A element
does not follow. I then added code to the function I had to fade out
the box and save a cookie to show the user had closed the active
announcement box which removed the active-announcement class I had PHP
add to the A element.
The problem is, even though the removeClass() function is last in the
series of functions, it fires first - the positioned A element moves
up to where it should be BEFORE the active announcement box fades out.

How can I change this so that the positioned A element has its class
removed after the other two things have taken place?

Here's the jQuery code I have:
[code]
$("#close-notice").click(function(){

$("#notice").fadeOut(800);
createCookie('t3d_notice', 
't3dnotice_', 365);


$("#notice-tab").removeClass('active-notice');

}
);
[/code]


[jQuery] Re: generate AJAX data based on number of select elements

2009-04-13 Thread Kinsbane

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  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  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" 
> > 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" 
> > > wrote:
>
> > > > You are just trying to get the value of the select box and only the
> > > > select box???
>
> > > > So you have something like
> > > > 
> > > >  Book 1 ???
> > > >  Book 2 
> > > >  Book 3 
> > > >  Book 4 
> > > > 
>
> > > >  What do you need reqData to look like?


[jQuery] Re: generate AJAX data based on number of select elements

2009-04-10 Thread Kinsbane

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  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" 
> 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" 
> > wrote:
>
> > > You are just trying to get the value of the select box and only the
> > > select box???
>
> > > So you have something like
> > > 
> > >  Book 1 ???
> > >  Book 2 
> > >  Book 3 
> > >  Book 4 
> > > 
>
> > >  What do you need reqData to look like?


[jQuery] Re: generate AJAX data based on number of select elements

2009-04-09 Thread Kinsbane

Just hoping to see if there's a solution available.


[jQuery] Re: generate AJAX data based on number of select elements

2009-04-08 Thread Kinsbane

Sure can, Rick!

Here's the options var that gets created for the auto-suggest.
http://jsbin.com/enita/edit

In it, you'll see the callback function that gets fired when a user
clicks their entry after searching for something. You can see where I
built the HTML string for the list item element containing the select
element to choose a quantity, as well as a link back to the original
PDF document (haven't implemented that yet) and a brief description.

On Apr 8, 8:22 pm, "Rick Faircloth"  wrote:
> > I don't think I can incrementally increase a
> > the ID/name of the select by 1.
>
> There are a couple of ways to do that.
> Can you show me an example of the select that
> you'd like to use and how the options would need
> to increment?
>
> Rick
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>
> Behalf Of Kinsbane
> Sent: Wednesday, April 08, 2009 11:11 PM
> To: jQuery (English)
> Subject: [jQuery] Re: generate AJAX data based on number of select elements
>
> Thanks for the reply Rick. I'm just barely starting to get started
> with jQuery and AJAX in general, and while PHP wasn't terribly hard to
> pick up,
> I'm always trying to find the proper flow of logic to do things with
> JavaScript.
> Generally I try and find a loose example of what I want that someone
> else did, and adapt it to my needs by trial and error - I always seem
> to learn best that way.
> But this particular thing I don't think I've seen before and I don't
> know the first place to look for an example. It's pretty baffling.
> My other thought was to pre-define 15 or so selects in the data stream
> for the AJAX request and only include in the literature request those
> select ID's that have values..
> The problem there is, when a person selects a piece of literature, I'm
> not looping anything so I don't think I can incrementally increase a
> the ID/name of the select by 1.
> Or can I?
>
> On Apr 8, 6:48 pm, "Rick Faircloth"  wrote:
> > 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: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 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-se.
> ..
> > 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 !


[jQuery] Re: generate AJAX data based on number of select elements

2009-04-08 Thread Kinsbane

Thanks for the reply Rick. I'm just barely starting to get started
with jQuery and AJAX in general, and while PHP wasn't terribly hard to
pick up,
I'm always trying to find the proper flow of logic to do things with
JavaScript.
Generally I try and find a loose example of what I want that someone
else did, and adapt it to my needs by trial and error - I always seem
to learn best that way.
But this particular thing I don't think I've seen before and I don't
know the first place to look for an example. It's pretty baffling.
My other thought was to pre-define 15 or so selects in the data stream
for the AJAX request and only include in the literature request those
select ID's that have values..
The problem there is, when a person selects a piece of literature, I'm
not looping anything so I don't think I can incrementally increase a
the ID/name of the select by 1.
Or can I?


On Apr 8, 6:48 pm, "Rick Faircloth"  wrote:
> 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: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 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-se...
> 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 !


[jQuery] generate AJAX data based on number of select elements

2009-04-08 Thread Kinsbane

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

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 !