JQUERY 1.8.3 で動作する古い AJAX コードがありますが、それ以降のバージョンでは失敗します。コードを最新の状態に保ち、非推奨のコードを回避しようとするため、スクリプトを更新する必要があります。
現在のコード
$('.productlist input[type=submit]').bind('click', function () {
var i = 0;
var a = $(this).closest('.productlist2').find('input[data-productid][value!=]').length;
$(this).closest('.productlist,.WPproductlist').find('input[data-productid][value!=]').each(function () {
if ($(this).attr('data-produktfarve') != "") {
$.ajax({
url: '?ProductID=' + $(this).attr('data-productid') + '&EcomOrderLineFieldInput_farvevalg=' + $(this).attr('data-produktfarve') + '&Quantity=' + parseFloat($(this).val()) + '&cartcmd=add',
success: function (data) {
i++;
if (i == a) {
window.location.reload();
}
}
});
} else {
$.ajax({
url: '?ProductID=' + $(this).attr('data-productid') + '&Quantity=' + parseFloat($(this).val()) + '&cartcmd=add',
success: function (data) {
i++;
if (i == a) {
window.location.reload();
}
}
});
}
});
setTimeout(function () {
window.location.reload();
}, 500);
return;
});
JQUERY get および post リクエストのさまざまな新しいバージョンを試しましたが、役に立ちませんでした。