There are a couple of ways you can do this. I'm going to do a blog
entry on this in a few minutes with a full example, but, you can have
logic like this:

(pseudo-code obviously for this part)
if I need to login:
  if ajax request, throw an exception with a specific message
  else redirect to login.cfm

Then in your JS code, make use of the global Ajax object to see errors:

        $.ajaxSetup({
                        error:function(x,e){
                                if(x.status == 500 && x.statusText == 
"SessionTimeout") {
                                        alert("Your session has timed out.");
                                        location.href = 'index.cfm';
                                }

                        }
                });
        

On Wed, Sep 8, 2010 at 10:45 AM, Tony Bentley
<cascadefreehee...@gmail.com> wrote:
>
> Has anyone used cfhttp to throw an ajax error that returns a JSON object and 
> error code 500? I'm looking for a code snippet of your onError() method. I'm 
> using jQuery and am also trying to decide how to handle it on the client 
> side. Specifically looking for when a session expires and when a server error 
> occurs what to do on the client side (session expiration refreshes the page 
> to login panel,etc).
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336899
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to