JSFiddle - React, Tailwind, and code Playground

by st3fan

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

JavaScript

var api = {
  username: '[email protected]',
  password: 'kwapi123',
  host: 'https://cors-anywhere.herokuapp.com/https://www.trippus.se/web/services/distributed/api/'
};

$.ajax({
  type: 'GET',
  url: api.host + 'Calendar/GetAllCourses',
  dataType: 'json',
  crossDomain: true,
  //async: false,
  data: {
  	TriadId : 510,
  	LanguageId : 'eng',
  	CalendarId : 44
  },
  xhrFields: {
    withCredentials: true
  },
  headers: {
    'Authorization': 'Basic ' + btoa(api.username + ':' + api.password),
    //'Origin': 'jsfiddle.net'
  },
  beforeSend: function (xhr) {
    console.log(xhr); // DEBUG
    //xhr.setRequestHeader('Authorization', make_base_auth(username, password)); 
  },
  success: function () {
    console.log('success', arguments);
  },
  error: function (data, status, headers, config) {
    console.log('error', arguments);
  }
});