Unable to fetch data from mediawiki api using XMLHttpRequest

Tell us what’s happening:

request always gets cancelled

Your code so far

submit.onclick = function(){
   var xhr = new XMLHttpRequest();
  xhr.setRequestHeader( 'Api-User-Agent', 'sushanthrao6@gmail.com' );
  xhr.onreadystatechange = function(){
    if(xhr.readyState == 4 &&  xhr.status == 200){
       var response = JSON.parse(xhr.responseText);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36.

Link to the challenge:

Add origin=* to the request as shown here

still the request is getting canceled after adding origin = * in the url
xhr status is cancelled

Thanks SkyC it worked