在此代码中运行良好并显示所有数据。这是一段javascript代码
checkoutCart:
function(products, totalPrice, totalQuantity) {
var checkoutString = "Total Price: " + totalPrice + "\nTotal Quantity: " + totalQuantity;
checkoutString += "\n\n id \t name \t summary \t price \t quantity \t image path";
$.each(products, function(){
checkoutString += ("\n " + this.id + " \t " + this.name + " \t " + this.summary + " \t " + this.price + " \t " + this.quantity + " \t " + this.image);
});
alert(checkoutString)
在这段代码之后,我想使用带有id传递的href属性。在使用alert函数之后然后按下ok按钮,之后我的href链接工作正常,但是在url bar中显示order.php?id = undefined。这是代码
window.location.href="order.php?id="+this.id ;