Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- var token;
- $("#getToken1").click(function () {
- var user = {
- grant_type: 'password',
- username: '***@gmail.com',
- password: '!aA1234'
- };
- $.ajax({
- type: 'POST',
- url: 'http://localhost:65370/Token',
- data: user,
- success: function (data) {
- var parsedResponseBody = JSON.parse(JSON.stringify(data));
- token = parsedResponseBody.access_token;
- }
- });
- });
- </script>
- <script>
- $("#read1").click(function () {
- $.support.cors = true;
- $.ajax({
- crossDomain: true,
- url: 'http://localhost:65370/api/travels',
- headers: {
- 'Authorization': 'Bearer ' + token
- },
- type: 'GET',
- success: function (data) {
- alert(JSON.stringify(data));
- }
- });
- });
- </script>
Add Comment
Please, Sign In to add comment