「の」私は、構文の問題を抱えている、私は最終的なコードは次のようになりますので、shopifyでカートにgo.pl分析を統合しようとしています:配列プッシュのループ(ジャバスクリプト)
var goadservicesq = goadservicesq || [];
goadservicesq.push(
[
"_BASKET",
[
// first position in basket
{
identifier: '35353635535',
quantity: '2'
},
// second position in basket
{
identifier: '55353533378566',
quantity: '1'
},
// last position in basket
{
identifier: '458457435643464',
quantity: '3'
},
// extra product which solves the "comma" problem
{}
]
]
);
と、ここで私は、上記のような最終的な結果を持っている内部ループ「のために」作るしようとしています:
// trying to make "for" loop
$.getJSON("/cart.js", function(data) {
console.log(data);
// user.go.pl CART script
var goadservicesq = goadservicesq || [];
goadservicesq.push(
[
"_BASKET",
[
for (var i = 0; i < data.items_count; i++) {
{
identifier: data.items[i].id,
quantity: data.items[i].quantity
},
}
// extra product which solves the "comma" problem
{}
]
]
);
});
それはエラーをスローする - >http://prntscr.com/ci7jpz 私を助けてください。