-1
var link = " http://www.supremenewyork.com/shop/"
var itemType = "shirts"
var id = "ovlutjfac"
fullLink = link + itemType + "/" + id
var size;
function addToCart() {
var info = {
'size': 32734,
'commit': ''
}
$.ajax({
url: fullLink,
type: 'post',
data: info
}).done(function() {
console.log("Successfully added item to cart");
});
}
addToCart();
不會將項目添加到購物車,即時通訊試圖使它所以如果我有一個鏈接一個至高無上的項目出來,我只是運行此腳本之前,並把它添加到購物車立即 其http://www.supremenewyork.com/shop/shirts/ovlutjfac/black我該如何製作這個腳本實際上發佈?
http://www.supremenewyork.com/shop/shirtsovlutjfac
這是因爲你的豐聯變量是越來越有「http://www.supremenewyork.com/shop/shirtsovlutjfac」初始化。你應該在itemType和id之間加上'/',用var fullLink = link + itemType +「/」+ id –
一旦你修好了鏈接,你會注意到它不會工作,因爲CORS – baao
修復Cors? – Oliver