Skip to content

Instantly share code, notes, and snippets.

@otis22
Created October 13, 2020 12:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otis22/daf37af3807bd66e55ac5b8937aa99d2 to your computer and use it in GitHub Desktop.
Save otis22/daf37af3807bd66e55ac5b8937aa99d2 to your computer and use it in GitHub Desktop.
JS function which will return full clinic url by clinic domain name.
function vetmanagerUrl(domain_name) {
var request = new XMLHttpRequest();
var result = '';
request.open('Get', 'https://billing-api.vetmanager.cloud/host/'+domain_name, false);
request.onreadystatechange = function() {
if(request.readyState === 4) {
switch (request.status) {
case 200:
var response = JSON.parse(request.response);
result += response.protocol + "://" + response.url;
break;
default:
alert('An error occurred during your request: ' + request.status + ' ' + request.statusText);
break;
}
}
};
request.send()
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment