I am using the below code to get the customer details from shopify. I have redirected my domain to the other domain from the shopify admin.
function setEmailWithLoggedInUser(callback) {
$.ajax({
url: 'https://new-website-shopify.myshopify.com/admin/customers/'+__st.cid+'.json',
crossDomain: true,
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic XXXXXXXXXXXX")
}, success: function(data){
console.log(data);
if(callback)
callback();
}
})
I have done a lot of work around but unable to find the solution. I am getting this error:
Failed to load resource: the server responded with a status of 404 (Not Found)
XMLHttpRequest cannot load https://new-website-shopify.myshopify.com/admin/customers/7094124372.json. Response to preflight request doesn't pass access control check:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.beirutshopping.com' is therefore not allowed access. The response had HTTP status code 404.
https://new-website-shopify.myshopify.com/admin/customers/7094124372.json
URL (with whatever the real hostname is) into your browser address bar, what happens? – sideshowbarkerhttps://new-website-shopify.myshopify.com/admin/customers/
? You able to make configuration changes to it? What server backend does it run? The problem you’re hitting here seems to be the same as explained in the answer at stackoverflow.com/questions/45557941/…. See also the How to avoid the CORS preflight section of the answer at stackoverflow.com/questions/43871637/… for some possible ways to work around this. – sideshowbarker