I have clients that call AJAX calls. These calls refer to URLs protected by Spring Security on the server side. If the user session has ended, I have a pop-up window of the lightbox login form. After successfully logging in, I want the client to re-execute the AJAX call.
Here is a sample client-side code that calls an AJAX call:
function handleSearchClick(evt) { var setupOptions = { success: loadSearch, type: "POST", dataType: "json", url: "../search.ajax", error: handleError,
When authentication fails, the server returns 401, with the result that the client raises a handleError. Is it possible to pass a handleError callback function? I would like the callback to re-execute
$("#searchForm").ajaxSubmit(setupOptions);
I have seen solutions to this problem when the server returns a success response to AJAX calls that have a session timeout. The success function then searches for something in the response to find out the session timeout. The client then saves the callback function. I prefer to handle this in error function.
James
source share