title: Can't Get Json from Flask Rest API using getJSON
body: <p>I am new in Javascript and I get the following problem. So I make a simple Flask API return a simple json</p>
  
  <p>Flask code:</p>
  
  <pre><code>from flask import Flask, jsonify
  app = Flask(__name__)
  @app.route('/test')
  def test():
      return jsonify({"result":"wt is works!"})
  
  if __name__=="__main__":
      app.run()
  </code></pre>
  
  <p>I run it using <code>gunicorn -k gevent -w 5 main:app</code> and when I check <code>localhost:8000/test</code> in browser it returns the json normally</p>
  
  <p>But when I try to get it using Jquery it return nothing. My HTML didn't get any value from <code>localhost:8000/test</code></p>
  
  <p>My current html code:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script src="https://code.jquery.com/jquery-3.2.1.min.js"&gt;&lt;/script&gt;
          &lt;script type=text/javascript&gt;
              $(document).ready(function(){
                  $.getJSON(
                      "http://localhost:8000/test",
                      {format: "json"})
                      .done(
                          function(data) {
                              var plot_id = data.result;
                              $("#retval").html( "&lt;strong&gt;" + plot_id + "&lt;/strong&gt;" );
                          }
                      );
              });
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="retval"&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But when I change the url and try to get data from another API, let say from <a href="https://jsonplaceholder.typicode.com/posts/1" rel="nofollow noreferrer">https://jsonplaceholder.typicode.com/posts/1</a> it works.</p>
  
  <p>I've tried solution from:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/24735810/python-flask-get-json-data-to-display">Python Flask get json data to display</a> (without <code>.done()</code> and using <code>.ajax</code>)</li>
  <li><a href="https://stackoverflow.com/questions/9984665/external-api-get-request-using-jquery">External API GET() request using jQuery</a> (using <code>callback=?</code>)</li>
  <li>And also tried to run using <code>python</code> command instead of <code>gunicorn</code></li>
  </ul>
  
  <p>but it still doesn't work, can somebody help me please to find out what is the problem?</p>