$.ajax({
'url':"login.php",
'dataType':'json',
'type':'post',
'data':'name='+name+"&password="+password,
success:function(res){
console.log(res.token)
}
});
$.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)
}
});