我有一个外部JSON端点,我试图通过该端点检索要在前端填充的实时数据,但一直被CORS阻止。我是否需要设置一个私人应用程序才能执行此操作,或者我需要专门执行一些操作才能使其正常工作?
Access to XMLHttpRequest at 'https://somewebsite.com/api/prices' from origin 'https://www.myshopifysite.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
<script>
var data = {};
jQuery.ajax({
type: 'GET',
url: 'https://somewebsite.com/api/prices',
data: data,
dataType: 'json',
success: function(data) {
console.log(data);
}
});
</script>