Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. var URL = "https://realla.co/api/v1/listings/search";
  2. var usr = 'api';
  3. var psw = 'hidden';
  4. $.ajax({
  5. type: "POST",
  6. dataType: "json",
  7. contentType: "application/json",
  8. url: URL,
  9. crossDomain: true,
  10. beforeSend: function(xhr) {
  11. xhr.setRequestHeader("Authorization", "Basic " + btoa(usr + ":" + psw))
  12. },
  13. success: function(result) {
  14. console.log('success');
  15. },
  16. error: function(req, status, err) {
  17. console.log('Something went wrong', status, err);
  18. }
  19. });
  20.  
  21. XMLHttpRequest cannot load https://realla.co/api/v1/listings/search. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://dw.dev' is therefore not allowed access. The response had HTTP status code 403.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement