problem description
Thepython flask framework has a button that cannot be implemented to jump to that interface. I don"t know if I didn"t get it somewhere.
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)
@ user_dp.route ("/ provideOrders", methods= ["POST"])
def provideOrders ():
uid = session.get("uid")
if uid is None:
return redirect(url_for("user.login"))
user = User.query.get(uid)
sp_ids = request.form.get("sp_ids")
all_money = 0
if sp_ids is not None:
oid = str(uuid.uuid1()).replace("-", "")
order = Order(id=oid, user=user, name="", phone="", addr="")
db.session.commit()
sp_ids = str(sp_ids).split("_")
for sp_id in sp_ids:
if sp_id is not None:
sp_id = str(sp_id)
shopCart = ShopCart.query.get(sp_id)
if shopCart is None:
return redirect(url_for("user.userInfo", tab=2))
if shopCart is not None:
all_money = shopCart.subTotal
orderItem = OrderItem(id=shopCart.id, count=shopCart.count, sub_total=shopCart.subTotal,
product=shopCart.product)
orderItem.order = order
db.session.delete(shopCart)
db.session.commit()
user.shop_time = None
order.total_money = all_money
db.session.commit()
return jsonify({"error": "0", "oid": order.id})
return jsonify({"error": "1"})
@ user_dp.route ("/ showOrder")
def showOrder ():
oid = request.args.get("oid")
if oid is not None:
order = Order.query.get(str(oid))
if order is None:
return redirect(url_for("index"))
return render_template("order.html", order=order)
$(".calBtn") .click (function () {
if($(this).children("a").hasClass("btn_sty") && $(".son_check + label.mark").length > 0){
var sp_ids = ""
$(".son_check + label.mark").each(function () {
sp_ids += ($(this).attr("for")+"_")
})
$.post("/user/provideOrders",{"sp_ids":sp_ids},function (result) {
if(result.error == 0){
zlalert.alertSuccess("",function () {
window.location.href="/user/showOrder?oid="+result.oid
})
}
})
}
})
< button type= "button" class= "btn btn-success calBtn" > to pay < / button >
what result do you expect? What is the error message actually seen?
how to implement this button to make it jump normally. In fact, there is no response to the click.