//加入购物车操作
var buyAccount;
$("#add_cart").click(function (e) {
//数量取值
buyAccount = $("#buy-num").val();
console.log(buyAccount);
var params = {
count: buyAccount,
product: <%=book.getIsbn()%>
};
alert(document.getElementById("buy-num").value);
$.ajax({
type: "post",
url: "${pageContext.request.contextPath}/servlet/CartServlet",
data: "uid=<%=user.getPhone()%>&isbn=<%=book.getIsbn()%>",
success: function (data) {
if (data == 'yes') {
alert("添加购物车成功!");
window.location.href = "${pageContext.request.contextPath}/servlet/CartServlet?isbn=<%=book.getIsbn()%>?count=document.getElementById("buy-num").value";
} else {
alert("添加购物车失败!");
}
},
error: function (data) {
alert("系统异常!");
}
});
ajax 传过去 啊