Skip to content Skip to sidebar Skip to footer

Authenticate User, Redirect With XHR Request

I am looking at this guide to help me with setting up a 'Add to Cart' feature within my application. Within the guide the author only allows a user to add to the basket if they are

Solution 1:

You should catch the 401 in your ajax response and then redirect like this:

  $(document).on "ajaxError", (event, request, settings) ->
    if request.status == 401
      window.location.href = '/'

Post a Comment for "Authenticate User, Redirect With XHR Request"