我正在Shopify商店使用私人应用程序,并试图通过Ajax将JSON发布到我的商店。
这是数据(样本)
var newCustomer = {
"customer": {
"first_name": "Steve",
"last_name": "Lastnameson",
"email": "steve.lastnameson@lastnamesonco.com",
"verified_email": true,
"addresses": [
{
"address1": "123 Oak St",
"city": "Ottawa",
"country": "CA",
"first_name": "Mother",
"last_name": "Lastnameson",
"phone": "555-1212",
"province": "ON",
"zip": "123 ABC"
}
]
}
};
这是我的Ajax调用(注意:url不是我在实际调用中使用的那个)
$.ajax({
type: "POST",
url: "https://apikey:password@hostname/admin/resource.json",
data: newCustomer,
contentType: "application/json",
dataType: "jsonp",
success: function(){console.log('Success');},
failure: function(){console.log('Failure');}
});
这是一个跨域调用。
我的console.log
根本没有得到任何结果。
有任何Shopify用户成功完成此操作吗?
Here is some documentation on either a getting or posting from Shopify