Hi T.J.,

Thanks for your response.Your suggestion of updating the body element
does almost what I want, but it will disrupt the way the browser's
back button work since the operation will be a page element update
instead of a new pageload.

What do you mean by "I don't think branching on the result really
argues this either for or against Ajax.Request."?

My understanding is that Ajax.Request renders a new webpage using the
server response, whereas Ajax.Updater updates page elements.
Are you suggesting that it's possible to 1) Get data from server, 2)
parse the data (see if has an http header), and then 3) call a
separate operation that will render an element or render a new page?
If so, how would I do that?

Thanks

Alex

On Mar 24, 2:49 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi,
>
> > I'm wondering if there's a way to trick Ajax.Updater to update the
> > whole page rather than a specific element.
>
> You can tell it to update the `body` element -- that's very nearly the
> whole page. Just give the body and ID and then give that ID to the
> updater as its success target.
>
> > I can't use Ajax.Request since the client doesn't know if it will be
> > rendering a full page or an update until the response comes back from
> > the server.
>
> I don't think branching on the result really argues this either for or
> against Ajax.Request.
>
> Here's an example using Ajax.Updater to update the body:
>
> First, add an ID to body:
>
>     <body id="bodyId">
>
> Then this updater code:
>
>     new Ajax.Updater({success: "bodyId"}, "url", {
>         onFailure: function(response) {
>             $('failureId').update(
>                 "The request failed with status code " +
>                 response.status +
>                 ": " +
>                 (response.statusText || "(no detail given)"));
>         }
>     });
>
> Of course, updating the body doesn't update the title or other things
> in the head element.
>
> FWIW,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Mar 24, 2:16 am, stupakov <stupa...@gmail.com> wrote:
>
>
>
> > Hi all,
> > I'm wondering if there's a way to trick Ajax.Updater to update the
> > whole page rather than a specific element.
> > Basically I'd like to update the entire page in case of "success" or
> > an element in case of "failure"
> > I can't use Ajax.Request since the client doesn't know if it will be
> > rendering a full page or an update until the response comes back from
> > the server.
> > I've looked through the Ajax.Updater code in prototype.js but I don't
> > know js well enough to figure this out.. (I'm using rails and have
> > been relying on prototype for all my js)
> > Is there a way to get Updater to do what I want or will I need to
> > modify the prototype helper or write my own ajax js code?
> > Thanks!
> > Alex

-- 
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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to