$(document).ready(
function() {
$("body").ajaxError(
function(e,request) {
if (request.status == 403) {
window.location.reload();
//window.location.href = "/myapp/login";
}
}
);
}
);
Code language: JavaScript (javascript)
In above code, we have added a handler function to ajaxError which gets called by jQuery whenever there is an error in the HTTP Response. The function checks if the status code is 403, if it is then it simply tries to reload the URL. This generate a new request to the server which automatically gets redirected to the login page. The only disadvantage of reloading the page is that you generate a new HTTP request which server has to handle and redirect to Login page. You may wish to directly redirect user to login page from client code itself. Check the Line XX where we are changing the windows location and redirecting user. I personally dont like this method as you have to hard code the path for login page in javascript. I prefer using the previous solution to reload the page. I am sure there must be several way of implementing this in Javascript. Share yours if you think you have a better one :) Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…
Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…
Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…
1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…
GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…
1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…
View Comments
hello all, i would like to read the database table data dynamically using ajax with struts framework. for this can u please suggest me to do that application, ofcourse i m much Familiar with struts but i m beginner with ajax thats main problem here. could you please give me the reply as early as possible. Hope this application will be good.
Thanks in Advance.
sir, thanks for the tutorials. its very helpful but i am new at learning ajax. so can u send me simple example for ajax like only form submission, content change viaa server etc