我仅在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);
}
});
}
答案 0 :(得分:3)
function updateSalesQty(id_sale,id_product,id_customer,sign=0,qty=0)
到目前为止,JS中的only firefox supports default arguments。 您必须在函数内部设置默认值,例如
sign = sign || 0;
或
qty = (typeof qty !== 'undefined') ? qty : 0;