/*
| ----------------------------------------------------------------------------------
| 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的值,然后插入数据库?大神求解!!在线等