jquery调用jwt

getToken

$.ajax({
            'url':"login.php",
            'dataType':'json',
            'type':'post',
            'data':'name='+name+"&password="+password,
            success:function(res){
                console.log(res.token)
            }
        });

sendData

 $.ajax({
            'url':"data.php",
            'dataType':'json',
            'type':'post',
            'beforeSend':function(request) {
                request.setRequestHeader("Authorization", token);
            },
            'data':'message='+message+"&name="+username,
            success:function(res){
                 console.log(res)
            }
        });