Prestashop:Uncaught SyntaxError:仅限意外的标记chrome

时间:2014-04-26 07:26:41

标签: javascript syntax-error prestashop

我仅在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);
                }
            });

        }

1 个答案:

答案 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;