Skip to content
Myr

jqueryexample.py

This file

Path

examples/jqueryexample/jqueryexample.py

29 lines · 660 bytes · Python

Last changed by

revert copyright year to project startDavid Lordbefore adoption310fbfc

History of this file

Take it

1# -*- coding: utf-8 -*-2"""3    jQuery Example4    ~~~~~~~~~~~~~~56    A simple application that shows how Flask and jQuery get along.78    :copyright: © 2010 by the Pallets team.9    :license: BSD, see LICENSE for more details.10"""1112from flask import Flask, jsonify, render_template, request13app = Flask(__name__)141516@app.route('/_add_numbers')17def add_numbers():18    """Add two numbers server side, ridiculous but well..."""19    a = request.args.get('a', 0, type=int)20    b = request.args.get('b', 0, type=int)21    return jsonify(result=a + b)222324@app.route('/')25def index():26    return render_template('index.html')2728if __name__ == '__main__':29    app.run()