Advertisement
Guest User

Untitled

a guest
May 30th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. $(document).ready(function() {
  2. var sJWT = KJUR.jws.JWS.sign(null, {alg: 'HS256'}, 'Maks', 'my secret is shhhhh');
  3. $.ajax({
  4. type: "POST",
  5. dataType: 'json',
  6. url: "http://192.168.2.29:3000/mapi/resources/mlogin",
  7. timeout: 500,
  8. data: {username: 'maksmaks@1337.com', password: '13371337'},
  9. success: function(data) {
  10. //show content
  11. console.log(data.status + " Auth");
  12. console.log(data.message);
  13. console.log('Success!')
  14. },
  15. error: function( data1 ) {
  16. console.log( data1.status + " Auth");
  17. console.log( data1.responseJSON);
  18.  
  19. }
  20. });
  21.  
  22. /*$.ajax({
  23. type: "POST",
  24. dataType: 'json',
  25. url: "http://192.168.2.29:3000/api/resources/report",
  26. data: {cause: 'Jesus', company: 'MAMK', details: 'Hail Hydra'},
  27. success: function(data) {
  28. //show content
  29. console.log(data.status + " Auth");
  30. console.log(data.message);
  31. console.log('Success!')
  32. },
  33. error: function( data1 ) {
  34. console.log( data1.status + " Auth");
  35. console.log( data1.responseJSON);
  36.  
  37. }
  38. });
  39. */
  40. $.ajax({
  41. type: 'GET',
  42. dataType: 'json',
  43. url: 'http://192.168.2.29:3000/api/resources/reports/',
  44. //data: {username: 'maksmaks@1337.com', password: '13371337'},
  45. success: function(data){
  46. console.log(data);
  47. },
  48. error: function(data){
  49. console.log(data.status + " GetAllReports");
  50. console.log(data.message);
  51. }
  52. });
  53.  
  54. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement