I want to get from jira a list of all tickets , I used XMLHttpRequest(), but I get an error when I try to parse the response with json (unexpected end of data at line 1 column 1 of the JSON data), this is my code:
<script type="text/javascript">
function request(){
var xhr = new XMLHttpRequest();
baseURL="...jira/rest/api/2/...";
xhr.open("GET", baseURL, true);
xhr.setRequestHeader("Authorization", "Basic "+btoa("userName:password"));
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send();
var response = JSON.parse(xhr.responseText);
document.write(response);
}
request();
</script>