Created
October 13, 2020 12:56
-
-
Save otis22/daf37af3807bd66e55ac5b8937aa99d2 to your computer and use it in GitHub Desktop.
JS function which will return full clinic url by clinic domain name.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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