I'm making a jsonp request and I get this error Refused to execute script from 'https://myurl/test.php?callback=%27callback%27' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
despite the request returns a 200 code.
function callback(response){
alert(response);
}
var script = document.createElement("script");
//Set the Type.
script.type = "text/javascript";
//Set the source to the URL the JSON Service.
script.src = "https://myurl/test.php?callback='callback'";
//Append the script element to the HEAD section.
document.getElementsByTagName("head")[0].appendChild(script);
and this is test.php
<?php
$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
echo json_encode($arr);
?>