var ourRequest = new XMLHttpRequest(); ourRequest.open('GET', 'https://navkolosvity.com.ua/wp-json/wp/v2/posts'); ourRequest.onload = function(){ if (ourRequest.status >= 200 && ourRequest < 400) { var data = JSON.parse(ourRequest.responseText); console.log(data); }else{ console.log("We conect to the server, but it returent an error."); } }; ourRequest.onerror = function(){ console.log("Conection error!"); } ourRequest.send(); 

and here I have Error

  Refused to connect to 'https://navkolosvity.com.ua/wp-json/wp/v2/posts' because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback. 

    1 answer 1

    Most likely you are using the Content Security Plugin with standard settings, you need to allow the plugin to take data from the https://navkolosvity.com.ua source to configure the plugin