gpt4 book ai didi

javascript - Prestashop : Uncaught SyntaxError: Unexpected token chrome only

转载 作者:行者123 更新时间:2023-11-28 19:51:51 24 4
gpt4 key购买 nike

我仅在 Chrome 浏览器中收到 Uncaught Syntax Error: Unexpected token= 错误,并且该错误指向我的函数附近

function updateSalesQty(id_sale,id_product,id_customer,sign=0,qty=0)
{

指向此处时出错

$.ajax({
type:'POST',
url: 'index.php?controller=AdminCarts&token=fc9ff5f59559a3d4137b247a768bf320',
data : {
ajax: '1',
token: 'fc9ff5f59559a3d4137b247a768bf320',
tab: 'AdminCarts',
action: 'updateSaleQty',
id_sale: id_sale,
id_product: id_product,
id_customer: id_customer,
sign:sign,
qty:qty,
},
success : function(res)
{
$('#customer_sale tbody').html(res);
}
});

}

最佳答案

function updateSalesQty(id_sale,id_product,id_customer,sign=0,qty=0)

到目前为止,only firefox supports default arguments在JS中。您必须在函数内部设置默认值,例如

sign = sign || 0;

qty = (typeof qty !== 'undefined') ? qty : 0;

关于javascript - Prestashop : Uncaught SyntaxError: Unexpected token chrome only,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23308017/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com