Fix spring-security Session Timeout Ajax request no redirect issue

Source: Internet
Author: User

Tags: doc on () span data return JSON simple tips observation

At the beginning, the code is like this:

        $.ajax ({            "POST",            Url:ssource,            false,            "JSON",            Data:aodata,            success:function (resp) {                alert (one)                fncallback (resp);                $ (' Data loading complete ', 1, ' success.gif ', function () {                 });            }         });

Spring-security session timeout, the query button can still click, and did not jump, observed that this method has problems.

Knowing more about the use of Ajax requests, the problem is that the request is in JSON format, and after the spring-security session expires, the redirected login page is returned, so we know what to do.

The reason is not complex, the solution is simple,---added error handling methods, problem solving!

,            error:function (XMLHttpRequest, Textstatus, Errorthrown) {                /*  alert (textstatus)//  here is Parsefailue                alert (errorthrown)//Here The display is parsing JSON                 error, =                  Xmlhttprequest.responsetext                //  alert (responsetext)                  document.write ( ResponseText);             },            complete:function (XMLHttpRequest, textstatus) {                            }

Keep it down!

Fix spring-security Session Timeout Ajax request no redirect issue

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: