Thanks Collin

I will try to modify my script to use this approach but the Ajax
Updater is working and in some circunstances it is called 3 times with
success.

Furia

On Jan 18, 2:48 pm, ColinFine <[email protected]> wrote:
> On Jan 14, 11:04 pm, nfuria <[email protected]> wrote:
>
> > I have a page that shows a long table with the result of a ajax
> > request.
> > For design reasons, I want the header of the table to stay fixed when
> > the body scrolls.
> > To achieve this, I created 2 divs - one fixed and other normal.
> > So, I need to  to update the 2 divs at same time and using the same
> > url (a php file).
>
> > For now I am using a function that do 2 updates calling the same php
> > with a parameter that causes each response to be truncated to the
> > desired content - only the head or only the body of the table:
> > function gen_table {
> >   var urlhead = 'search.php?res=head';
> >   var urlbody = ''search.php?res=body';
> >   new Ajax.Updater('divhead', urlhead);
> >   new Ajax.Updater('divbody', urlbody);
>
> > }
>
> > It works, but can I use some other method to avoid the duplicate
> > request?
>
> As far as I know, you cannot use Ajax.Updater for this: you need to
> use Ajax.Request and do the updating yourself.
>
> What I have done in this case is to return a JSON object of the form:
> {
>   idoffirstdiv : htmltogoinfirstdiv,
>   idofseconddiv : htmltogoinseconddiv
>
> }
>
> and then made my onSuccess function something like
>
> var results = $H(response.getJSON());
> results.each(function(pair) {
>   $(pair.key).innerHtml = pair.value;});
> > Thanks
> > Furia
-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.


Reply via email to