title: call python function from html code
body: <p>I'm now working to develop google app engine using flask framework i have create a template with different control i need no to call function in python from my html where i catch the button trigger by ajax script the html code as follow </p>
  
  <pre><code> &lt;html&gt;
  
   &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" &gt;&lt;/script&gt; 
  
   &lt;br&gt;
   &lt;form    action="" method="post" &gt;
   &lt;div id ="par_input" &gt;&lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;textarea id ="equation" rows="2" cols="60"&gt;&lt;/textarea&gt;        &lt;input id ="insert" type="button" onclick="insert_fun()" value="Insert"  &gt; &lt;!-- --&gt;
  
  &lt;/form&gt;
  
  
  &lt;/div&gt;
  
  
  &lt;script type="text/javascript"&gt;
  
  function insert_fun(){
  //window.alert("Tariq work !");
  $.ajax({
      type: 'POST',
      url: window.location.href + '/insert'
      });
      document.getElementById("equation").value = "{{ TARIQ_ID }}";
  }
  
  
  &lt;/script&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>and my python code is</p>
  
  <pre><code>from flask import Flask                     #import the Flask class.
  from flask import make_response
  from flask import render_template
  from flask import request
  from flask import session
  from flask.kvsession import KVSessionExtension
  from flask import abort
  from flask import jsonify
  
  
  
  from google.appengine.ext import webapp 
  from google.appengine.ext.webapp import template 
  
  APPLICATION_NAME='application test '
  
  app = Flask(__name__)   
  
  @app.route('/', methods=['GET'])
  def index():
  
  
  
   """Initialize a session for the current user, and render index.html."""
   TARIQ_ID = 'inside index function'
  
  
   # serving it.
   response = make_response(
                  render_template('tariq.html',
                    APPLICATION_NAME=APPLICATION_NAME,
                    TARIQ_ID=TARIQ_ID))
   response.headers['Content-Type'] = 'text/html'
   return response
  
  @app.route('/', methods=['POST'])
  def insert(self = webapp.RequestHandler):   
  
     TARIQ_ID = 'In Python Code Function__INSIDE RESPONSE___===='
     response = make_response(
                  render_template('tariq.html',
                    APPLICATION_NAME=APPLICATION_NAME,
                    TARIQ_ID=TARIQ_ID))
     response.headers['Content-Type'] = 'text/html'
     return response
  
  
  
  class MyHandler(webapp.RequestHandler): 
  
   def get(self): 
      TARIQ_ID = 'In Python Code Function__INSIDE get===='
      self.response.out.write(unicode(
          template.render('tariq.html',
                                  TARIQ_ID)))
  
   def post(self):
      TARIQ_ID = 'In Python Code Function__INSIDE post===='
      self.response.out.write(unicode(
          template.render('tariq.html',
                                  TARIQ_ID)))
  </code></pre>
  
  <p>def main(): 
       #app.debug = True
        #app.run(host='0.0.0.0', port=4567)   #we use the run() function to run the local server with     our application</p>
  
  <pre><code> app = webapp.WSGIApplication([
      (r'.*',MyHandler)], debug=True)
  wsgiref.handlers.CGIHandler().run(app)
  
  if __name__ == '__main__':
  main()
  </code></pre>
  
  <p>but the python function dose not return the updated value of TARIQ_ID also it dose not make any response please your help</p>