jQuery+cookies写的购物车怎么获取值再下订单给数据库插入?

 /*
    | ----------------------------------------------------------------------------------
    | Shopping cart - Fetch Cookie data and display cart items购物车-获取Cookie数据并显示购物车条目
    | ----------------------------------------------------------------------------------
    */
    function output_cookie()
    {
        var cookie = $.cookie('cart'); /*获取cookie*/
        if ( cookie === undefined ) return;
        cookie = $.parseJSON(cookie);


        for ( var x in cookie )
        {
            temp = cookie[x].price;
            temp = temp.replace( /^\D+/g, '');/*\d表示数字, + 表示一个或多个,就是把连续的多个数字替换为空*/
            temp = parseFloat(temp).toFixed(2);/*parseFloat(1.2222).toFixed(2);    ///1.22 */

            var $new = $('<tr> \
                            <td> \
                                <a class="entry-thumbnail" href="' + cookie[x].thumbnail + '" data-toggle="lightbox">\
                                    <img src="' + cookie[x].thumbnail + '" alt="' + cookie[x].title + '" /> \
                                </a> \
                                <a class="entry-title" href="' + cookie[x].url + '">' + cookie[x].title + '</a> \
                            </td> \
                            <td><span class="unit-price">' + cookie[x].price + '</span></td> \
                            <td> \
                                <div class="qty-btn-group"> \
                                    <button type="button" class="down"><i class="iconfont-caret-down inline-middle"></i></button> \
                                    <input type="text" value="' + cookie[x].qty + '" /> \
                                    <button type="button" class="up"><i class="iconfont-caret-up inline-middle"></i></button> \
                                </div> \
                            </td> \
                            <td class="hidden-xs"><strong class="text-bold row-total">¥' + temp + '</strong></td> \
                            <td class="hidden-xs"><button type="button" class="close" aria-hidden="true">×</button></td> \
                        </tr>');

            $new.appendTo( $('.tbl-cart tbody') );
            $new.find('[data-toggle="lightbox"]').magnificPopup({
                type: 'image'
            });
        }

        update_cart_total();
    }
    output_cookie();




这是在jQuery文件里面,但是我要怎么获取这里面每个cookies的值,然后插入数据库?大神求解!!在线等

看json字符串结构,然后服务器建立json对应的类模型,反序列化为类就可以读取入库了。自己找你使用的服务器端语言如何反序列化json字符串为对象就行了


        var cookie = $.cookie('cart'); /*获取cookie*/
        if ( cookie === undefined ) return;
                alert(cookie)///////////////////////