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

Jquery Ajax uses Token to verify identity

一个新手
一个新手Original
2017-09-22 10:21:573707browse

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("用户名或密码错误");
                        }
                }
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!

Statement:
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
Previous article:QGraphicsItem scalingNext article:QGraphicsItem scaling