title: show dynamically changing data in my web app by flask
body: <p>i want to show some dynamically changing   data from request api on my web app
  my request is :</p>
  
  <pre><code> url='https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-nav'
    z=[]
    r = requests.get(url)
    x=r.json()
    e1=x['result'][0]['Ask']
  </code></pre>
  
  <p>i want to display it on web app in pythonanywhere
  i have html file like this :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  
  &lt;head&gt;
      &lt;title&gt;Suggestions&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  Search: &lt;input type="text" id="search_form_input"&gt;&lt;/input&gt;
  
  &lt;div id="place_for_suggestions"&gt;&lt;/div&gt;
  
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
  $("#search_form_input").keyup(function(){
      var text = $(this).val();
  
      $.ajax({
        url: "/suggestions",
        type: "get",
        data: {jsdata: text},
        success: function(response) {
          $("#place_for_suggestions").html(response);
        },
        error: function(xhr) {
          //Do Something to handle error
        }
      });
  });
  &lt;/script&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>my flask file:</p>
  
  <pre><code>from flask import Flask, render_template, request
  import requests
  
  
  app = Flask(__name__)
  
  
  @app.route('/')
  def index():
      return render_template('index.html')
  
  
  @app.route('/suggestions')
  def suggestions():
      text = request.args.get('jsdata')
  
      suggestions_list = []
  
      if text:
           url='https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-nav'
           z=[]
           r = requests.get(url)
           x=r.json()
           e1=x['result'][0]['Ask']
           suggestions=e1
           for suggestion in suggestions:
              suggestions_list.append(suggestion.attrs['data'])
  
          #print(suggestions_list)
  
      return render_template('suggestions.html', suggestions=suggestions_list)
  
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>i get this error :</p>
  
  <pre><code>Internal Server Error
  </code></pre>
  
  <p>suggestions.html:</p>
  
  <pre><code>&lt;label id="value_lable"&gt;
      {% for suggestion in suggestions %}
          {{ suggestion }}&lt;br&gt;
      {% endfor %}
  &lt;/label&gt;
  The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
  </code></pre>
  
  <p>i think something with ajax. please help me. I have no idea how to fix it and how to update data from <a href="https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-nav" rel="nofollow noreferrer">https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-nav</a> dinamicly changing every 2-3 seconds for example </p>