Skip to content
Myr

jqueryexample.py

This file

Path

examples/jqueryexample/jqueryexample.py

25 lines · 616 bytes · Python

Last changed by

Updated the examples to be cli basedArmin Ronacherbefore adoption9ab5987

History of this file

Take it

The walk stopped after 200 commits: lines older than 29bda59 point at it.

Modernized docs in a few placesArmin Ronacherbefore adoption29bda59

lines 1–7why, one step back
1# -*- coding: utf-8 -*-
2"""3 jQuery Example4 ~~~~~~~~~~~~~~56 A simple application that shows how Flask and jQuery get along.7

Merge branch '0.10-maintenance'Daniel Neuhäuserbefore adoptiond517f35

line 8why, one step back
8 :copyright: (c) 2014 by Armin Ronacher.

Modernized docs in a few placesArmin Ronacherbefore adoption29bda59

lines 9–25why, one step back
9 :license: BSD, see LICENSE for more details.
10"""11from flask import Flask, jsonify, render_template, request12app = Flask(__name__)131415@app.route('/_add_numbers')16def add_numbers():17 """Add two numbers server side, ridiculous but well..."""18 a = request.args.get('a', 0, type=int)19 b = request.args.get('b', 0, type=int)20 return jsonify(result=a + b)212223@app.route('/')24def index():25 return render_template('index.html')