title: How to send Python data to JavaScript
body: <p>I am developing the web using google app engine. I used <code>jinja2</code> to send data from html to main. pays code. The problem is how to get the data from the javascript of html. Please let me know the correct answer. Thank you.</p>
  
  <p><strong>main.py</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>def get(self):
      db = connect_to_cloudsql()
      cursor = db.cursor()
      cursor.execute("set names utf8")
      cursor.execute("""select no, u_name, age, gender, U_adress, phone, car_num, penalty from User;""")
  
      data = cursor.fetchall() 
      array_list = []
  
      for row in data:
          temp = (row[0], str(row[1]), row[2], str(row[3]), str(row[4]), row[5], str(row[6]), row[7])
          array_list.append(temp)
  
      db.close()
  
      data = json.dumps(array_list)
      template_values = { 'data': data }
  
      template = JINJA_ENVIRONMENT.get_template('User.html')
      self.response.write(template.render(template_values))
  </code></pre>
  
  <p>and javascript code in html. </p>
  
  <pre class="lang-js prettyprint-override"><code>var table;
  
  $(function() {
      $.get(function({ data }) {
          var jsonobj = JSON.parse({ data });
  
          table = $('#userindex').dataTable({ 
              "sPaginationType": "bootstrap",
              "sDom": "t&lt;'row'&lt;'col-xs-6 col-left'i&gt;&lt;'col-xs-6 col-right'p&gt;&gt;",
              "bStateSave": false
          });
  
          $.each(jsonobj, function(key,value) {
              table.fnAddData(
                  value[0],
                  value[1],
                  value[2],
                  value[3],
                  value[4],
                  value[5],
                  value[6],
                  value[8]
              );
          });
      });
  });
  </code></pre>
  
  <p>this is my error</p>
  
  <blockquote>
    <p>datatables.min.js:16 GET <a href="https://firststep-2016.appspot.com/function%20(%7Bdata%7D)%7Bvar%20jsonobj%20=%20JSON.parse(%7Bdata%7D);table%20=%20" rel="nofollow noreferrer">https://firststep-2016.appspot.com/function%20(%7Bdata%7D)%7Bvar%20jsonobj%20=%20JSON.parse(%7Bdata%7D);table%20=%20</a>$(' 404 ()</p>
  </blockquote>