1 $.ajax({ 2 type: "GET", 3 url: "test.php", 4 success: function(data) { 5 console.log(data); 6 }, 7 beforeSend: function(xhr) { 8 token = window.localStorage.getItem('token'); 9 xhr.setRequestHeader("Authorization", "Bearer" + token); 10 } 11 });
1 $.ajax({ 2 type: "GET", 3 url: "test.php", 4 success: function(data) { 5 console.log(data); 6 }, 7 beforeSend: function(xhr) { 8 token = window.localStorage.getItem('token'); 9 xhr.setRequestHeader("Authorization", "Bearer" + token); 10 } 11 });
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。