I use AJAX to call a PHP file to load a JSON from an URL. This works without problem
PHP Code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://query1.finance.yahoo.com/v1/finance/search?q=tesl"esCount=10&newsCount=0');
$result = curl_exec($ch);
curl_close($ch);
$obj = json_decode($result);
print_r($obj);
Now i want to change it, so its loaded with jQuery from the clients Browser and not from the Webserver. So i tried this jQuery code:
jQuery.ajax({
dataType: 'jsonp',
url: 'https://query1.finance.yahoo.com/v1/finance/search?q=tesl"esCount=10&newsCount=0',
type: 'GET',
success: function(data){
console.log( data );
}
});
I tried some variation but i always get this Error
Cross-Origin Read Blocking (CORB) blocked cross-origin response
https://query1.finance.yahoo.com/v1/finance/search?q=asdf"esCount=10&newsCount=0&callback=jQuery351065066686635359_1614093535685&_=1614093535686 with MIME type application/json.
See https://www.chromestatus.com/feature/5629709824032768 for more details.
What am i doing wrong? Is there an other way to load the JSON with JS so its not going through the Webserver?
Thanks