前段页面:
var data = {
data: JSON.stringify({"flag":"0","start_year":$('#start_year').val(),"end_year":$("#end_year").val(),"trend_type":$("#trend_type").val(),
"trend_product":$("#trend_product").val(),"reporters":reporters})
}
app.title = '折柱混合';
$.ajax({
type:"POST",
url:"/load_history_byyear",
data:data,
success:function(data){
console.info("data:"+data.series);
}
});
后端后台:
@flask_app.route('/load_history_bymonth', methods=['POST', 'GET'])
def load_history_bymonth():
data = json.loads(request.form.get('data'))
flag = int(data['flag'])
select_year = data['select_year']
trend_type = data['trend_type']
trend_product = data['trend_product']
reporters = data['reporters']
datas = tradeservice.getTradeHistory(flag=flag, year=select_year, tradeflow=trend_type, product_name=trend_product,
reporters=reporters)
global history
history = jsonify(datas)
return jsonify(datas)