title: How to reference returned data in javascript from a web framework like bottle?
body: <p>I want to query my database, and return the results to javascript.</p>
  
  <p>javascript files that I'm serving using bottle</p>
  
  <pre><code>    @app.route('/static/&lt;filename:path&gt;', name='static')
      def send_static(filename):
          return static_file(filename, root='static')
  </code></pre>
  
  <p>and I'm not sure if I'm doing this correctly, but I added another route to specify which js file should get it.</p>
  
  <pre><code>    @app.route('/static/js/app.js')
      def ello():
          cur.execute("SELECT * FROM places")
          places= cur.fetchall()
          return {'places':places}
  </code></pre>
  
  <p>and then in that app.js file, I want to be able to do something like:</p>
  
  <pre><code>    console.log(places);
  </code></pre>
  
  <p>But I'm not really sure how to escape it. I'm using mako for the html templating which works fine but everything I've tried for javascript results in </p>
  
  <pre><code>    Uncaught SyntaxError: Unexpected token {
  </code></pre>
  
  <p>as suggested here: <a href="https://stackoverflow.com/a/14157401/1543640">https://stackoverflow.com/a/14157401/1543640</a></p>