That sounds right on the money, Brian.

Wendi, to give an example, suppose your code is something like this:

$(document).ready( function() {
    $.ajax({
        ...
    });
});

Let's say you want to make that $.ajax call both at load time and also later
in response to a click event on some div. Then you could do:

$(document).ready( function() {

    function loadSomething() {
        $.ajax({
            ...
        });
    }

    loadSomething();  // runs at "document ready" time

    $('#somediv').click( loadSomething );  // runs on the click

});

It's that simple!

Note that the reference to loadSomething in the .click() call does *not*
have parentheses after it. By leaving out the parens, we avoid calling the
function immediately. Instead we simply get a reference to the function that
we pass into .click() so that jQuery can call it later on the click event.

-Mike

On Mon, Dec 14, 2009 at 5:21 PM, brian <zijn.digi...@gmail.com> wrote:

> Put your $.ajax() call inside a function and call that on load and
> whatever other event.
>
> On Mon, Dec 14, 2009 at 8:18 PM, Wendi Turner <wenditur...@gmail.com>
> wrote:
> > Thank you Mike !
> >
> > Repost Question: "How can you remove/delete the active
> $(document).ready()
> > script, re-write and re-register then re-trigger the ready script??
> Without
> > reloading the page?"
> >
> > I have an anonymous
> >
> > $.ajax( function ( blah blah) )
> >
> > created in the $document.ready() object.
> >
> > I want to reload the $.ajax () object on a client event.
> >
> > How can I do this best?
> >
> >
> >
> > Michael Geary <m...@mg.to>
> >>
> >> Wendi, just a tip to help you get the assistance you're looking for:
> Since
> >> your question doesn't seem to relate to the topic of this particular
> thread,
> >> people may not notice it.
> >
> >
>

Reply via email to