Advertisement
Guest User

Untitled

a guest
Feb 15th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. $.ajax({
  2. type: 'GET',
  3. url: 'http://localhost/owncloud/index.php/apps/news/api/2.0/version',
  4. contentType: 'application/json',
  5. success: function (response) {
  6. // handle success
  7. },
  8. error: function () {
  9. // handle errors
  10. },
  11. beforeSend: function (xhr) {
  12. var username = 'admin';
  13. var password = 'admin';
  14. var auth = btoa(username + ':' + password);
  15. xhr.setRequestHeader('Authorization', 'Basic ' + auth);
  16. }
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement