Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. getAttendance() {
  2. const username = 'foo';
  3. const password = 'bar';
  4. const auth = btoa(username + ':' + password);
  5. $.ajax({
  6. type: 'GET',
  7. url: 'somelink',
  8. contentType: 'application/json, charset=utf-8',
  9. dataType: 'jsonp',
  10. async: true,
  11. headers: {
  12. 'Authorization': 'Basic ' + btoa(username + ':' + password)
  13. },
  14. error: function(xhr, status, error){
  15. console.log(error);
  16. },
  17. success: function(data){
  18. console.log(data);
  19. const req = JSON.stringify(data);
  20. const newreq = req.split('[');
  21. const res = newreq[1];
  22. const newres = res.split(']');
  23. const newnewres = newres[0];
  24. const response = '[' + newnewres + ']';
  25.  
  26. //return the response variable
  27. }
  28. });
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement