Having trouble getting Unresolved issues from API

Hey!
I'm trying to use the REST API to count how many Resolved and Unresolved issues we have each day.

I'm very new to this. Do you see any glaring issues with how my code is written?

The Chrome error console is giving me:
"XMLHttpRequest cannot load http://managemebugs.myjetbrains.com/rest/issue/byproject/ManageMe?filter=%23Unresolved. Origin http://localhost:8888 is not allowed by Access-Control-Allow-Origin."

Any ideas or thoughts are very welcome.
Thanks!





<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("POST", "http://managemebugs.myjetbrains.com/rest/user/login?rootusername&rootpassword",true)
xmlhttp.open("GET","http://managemebugs.myjetbrains.com/rest/issue/byproject/ManageMe?filter=%23Unresolved",true);
xmlhttp.send();
}
</script>
</head>
<body>

<h2>AJAX</h2>
<button type="button" onclick="loadXMLDoc()">Request data</button>
<div id="myDiv"></div>

</body>
</html>
1 comment
Comment actions Permalink
Hello, Jeffrey!
This message says, that origin, that you are making request to (in your case it's your YouTrack server) does not allows request from another origin (in your case this is web page's origin, that contains your javascript). You can read more about CORS here
About CORS support in YouTrack you can read here
If you have any more questions - I am happy to help!
Also, as I can see from your code, you are executing
xmlhttp.open("GET","http://managemebugs.myjetbrains.com/rest/issue/byproject/ManageMe?filter=%23Unresolved",true);
just once, but if there are too many Unresolved issues, they won't be returned to you. In this case you can use pagination.
0

Please sign in to leave a comment.