Within the given code snippet, the URL link
it appears that the website {mywordpresssite.wordpress.com} is currently unregistered.
In addition, please refer to the following for more information:
You can try using this code snippet as a reference:-
//create request object
var httpRequest;
//execute click event
document.getElementById("ajax_json_Btn").addEventListener('click', makeRequest);
// initiate http request
function makeRequest()
{
httpRequest = new XMLHttpRequest();
if (!httpRequest) {
alert('Could not create an XMLHTTP instance');
return false;
}
httpRequest.onreadystatechange = handleResponse;
httpRequest.open('GET','https://public-api.wordpress.com/rest/v1.1/sites/en.blog.wordpress.com/posts/7', true);
httpRequest.send();
}
//handle the http response
function handleResponse()
{
if (httpRequest.readyState === XMLHttpRequest.DONE)
{
if (httpRequest.status >= 200 && httpRequest.status < 400) {
var myObj = JSON.parse(httpRequest.responseText);
alert(myObj.site_ID);
// Uncomment the line below to see full response
// alert(httpRequest.responseText);
} else {
alert('There was an issue with the request.');
}
}
}