Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getAttendance() {
- const username = 'foo';
- const password = 'bar';
- const auth = btoa(username + ':' + password);
- $.ajax({
- type: 'GET',
- url: 'somelink',
- contentType: 'application/json, charset=utf-8',
- dataType: 'jsonp',
- async: true,
- headers: {
- 'Authorization': 'Basic ' + btoa(username + ':' + password)
- },
- error: function(xhr, status, error){
- console.log(error);
- },
- success: function(data){
- console.log(data);
- const req = JSON.stringify(data);
- const newreq = req.split('[');
- const res = newreq[1];
- const newres = res.split(']');
- const newnewres = newres[0];
- const response = '[' + newnewres + ']';
- //return the response variable
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement