jquery.ajax()函数参数: url: type:GET data datatype complete:请求完成时回调函数 success:请求成功 error:请求失败
return render_tempalte('xx.html') return jsonify(xxx) return '',204
from flask import Flask,make_response,json from jinja2.utils import generate_lorem_ipsum
app = Flask(name)
@app.route('/post') def show_post(): post_body = generate_lorem_ipsum(n=2) return ''' <h1>A very long post</h1> <div class="body">%s</div> <button id="load">Load More</button> <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <script type="text/javascript">
('#load').click(function() {
('.body').append(data); } }) }) }) </script>''' % post_body
@app.route('/more') def load_post(): return generate_lorem_ipsum(n=1)
if name == 'main': app.run( host='0.0.0.0', port=8888, debug=True )
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有