title: How to send data from flask to html template
body: <p>I have a small application where input is taken from the user and based on it data is displayed back on the html. I have to send data from flask to display on html but unable to find a way to do it. There's no error that I encountered.</p>
  
  <p>[UPDATED]:
  Python script :</p>
  
  <pre><code>    from flask import Flask, render_template, request
      import random
  
      app = Flask(__name__, template_folder='templates')
  
      @app.route('/', methods=['GET','POST'])
      def samplefunction():
          if request.method == 'GET':
              return render_template('new.html')
          if request.mthod == 'POST':
              greetIn = ['hey', 'hi', 'hey there', 'hi there', 'hello', 'hola', 'yoo']
              byeIn = ['bye', 'see you later', 'catch you later', 'toodles']
              nameOut = ['my name is Fatty!!', 'Fatty is my name', 'you can call me Fatty', 'I go by the name of Fatty']
              greetOut = ['hey there!', 'hi!', 'hi there!', 'hey!']
              byeOut = ['bye bye', 'bye. see you later']
  
              human1 = request.form['human']
  
              if human1 in greetIn:
                  bot = random.choice(greetOut)
                  return render_template('new.html', bot=bot)
              else:
                  bot = 'Sorry..no idea!!!'
                  return render_template('new.html', bot=bot)
  
    if __name__ == "__main__":
       app.run(debug=True)
  </code></pre>
  
  <p>HTML code :</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;BOT&lt;/title&gt;
      &lt;script&gt;
          var bot = {{ bot }}
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;h1&gt;Hello, type something to begin!&lt;/h1&gt;
        &lt;form method='post'&gt;
          Human: &lt;input type='text' name='human'&gt;&lt;br&gt;
          Bot: {{ bot }}&lt;br&gt;
          &lt;input type="submit" name="action"&gt;
        &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thank You!</p>