max_price").val(response.data['max_price']); } } } }); $("#favorite-action").on("click",".add-to-favorite",function(){ // $("#action").html('') var _sku = $("#product-sku").val(); var _max_price = parseFloat($("#max_price").val()); var _init_price = parseFloat($("#init_price").val()); if(_max_price < _init_price){ alert('出价不得低于起拍价'); }else{ $.ajax({ type:"post", url:'/favorite/add', data:{ sku:_sku, max_price:_max_price }, success:function(response){ if(response.code === 200){ $("#favoriteMsg").modal(); }else{ alert("出价失败"); } }, statusCode:{ 401:function(response){ window.location.href="/login?refer="+window.location.href; } } }); } }); });