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 / com
www.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