js push

Posted 盘思动

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js push相关的知识,希望对你有一定的参考价值。

    $(‘.main_div‘).each(function(){
        product_id = parseInt($(this).data(‘id‘));
        product_num = parseInt($(this).data(‘num‘));
        productList_array.productList.push({"productId":product_id,"quantity":product_num});
    });
    productList_array_jsonstr = JSON.stringify(productList_array);
    console.log(productList_array_jsonstr);

  

以上是关于js push的主要内容,如果未能解决你的问题,请参考以下文章