That's correct, ajaxSetup only sets the defaults for every ajax call.
Use ajaxSuccess instead:

$().ajaxSuccess(function(){
   //...
});

http://docs.jquery.com/Ajax/ajaxSuccess#callback

cheers,
- ricardo

On Mar 2, 12:08 pm, creemorian <creemor...@gmail.com> wrote:
> You're right, this what I'm doing ... I'm afraid I had some
> grammatical errors in my previous u'post.
>
> I'm sending an appropriate response from the server but what I'm
> trying to do is check for this response on a global basis using the
> $.ajaxSetup() function.
>
> Unfortunately the ajaxSetup's success() method doesn't execute if the
> local $.post() function has the success() method defined within.
>
> So it appears that $.ajaxSetup's success method is a fallback; used
> only when not otherwise defined. My expectation was that they would
> both execute ...
>
> Is there a way to define my desired actions without having to place
> the function in every callback function?
>
> Thanks and cheers!
>
> On Feb 27, 8:15 pm, James <james.gp....@gmail.com> wrote:
>
> > Since the session check is done server-side, you can do it with 
> > everyAJAXrequest server-side. If their session is not active anymore,
> > return a specific status for it. It's good to use JSON response for
> > this so you can return several sets of data, such as statuses, data,
> > etc.
>
> > On Feb 27, 12:45 pm, creemorian <creemor...@gmail.com> wrote:
>
> > > Along with everyAJAXcallback, I'd like to ensure that the user
> > > session is still active.
>
> > > So I have the following:
>
> > > >  jQuery.ajaxSetup({
> > > >    success: function(data, text)
> > > >    {
> > > >      if ( data.event == "login" ) {
> > > >        window.location.reload();
> > > >      }
> > > >    }
> > > >  });
>
> > > The aforementioned code functions perfectly well if theAJAXrequest
> > > object does *not* have the `({success: ... })` method defined
> > > locally...
>
> > > Is there any way to make theglobalmethod always? Or a better way to
> > > respond to an expired user session viaAJAX?
>
> > > Cheers for any suggestions.

Reply via email to