Home > Web Front-end > JS Tutorial > Jquery Ajax uses Token to verify identity

Jquery Ajax uses Token to verify identity

一个新手
Release: 2017-09-22 10:21:57
Original
3773 people have browsed it

Because I have done several backends recently, Token verification identity operations are often involved in the backend, so here is a record of how to transfer the request header and Token to the backend.

success:function(dat){
                    console.log(dat);                        
                    if(dat.code==1){
                            sessionStorage.setItem('token',dat.data.access_token);                            //这里设置缓存存储Token
                            sessionStorage.setItem('user',userName);
                            location.href = "index.html";
                        }else{
                            $(".tip2").html("用户名或密码错误");
                        }
                }
Copy after login
rrree

The above is the detailed content of Jquery Ajax uses Token to verify identity. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template