【发布时间】:2014-02-01 00:04:35
【问题描述】:
我有 Shopify 帐户。在管理员面板中,管理员可以将任意数量的产品添加到 Shopify 商店。
但我需要公众用户通过客户端从我的 Shopify 商店注册自定义产品。
我已经尝试了以下代码。
$('#send').click(function() {
$.ajax({
/* xxxx... : Api key
yyyy... : password */
url: 'https://xxxxxxxxxxxxxxxxxxxxxxxxxx:yyyyyyyyyyyyyyyyyyyyyyy@testing.myshopify.com/admin/orders.json',
type: 'POST',
dataType: 'json',
data: {
"product": {
"title": "Burton Custom Freestlye 151",
"body_html": "<strong>Good snowboard!</strong>",
"vendor": "Burton",
"product_type": "Snowboard",
"tags": "Barnes & Noble, John's Fav, \"Big Air\""
}
},
success: function(response) {
alert(response);
}
});
});
我收到以下错误:
XMLHttpRequest 无法加载 https://testing.myshopify.com/admin/orders.json。请求的资源上不存在“Access-Control-Allow-Origin”标头。因此不允许访问 Origin 'http://testing.myshopify.com'。
【问题讨论】: