Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8073687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:24:39+00:00 2026-06-05T14:24:39+00:00

Platform: Google App Engine (Python) Database: Google Cloud SQL I basically have a simple

  • 0

Platform: Google App Engine (Python)
Database: Google Cloud SQL

I basically have a simple webpage with a sidebar and a main view. The sidebar basically consists of a set of records from a database and when I click on one of them, I want more detailed information to be pulled from the database and displayed in the main view.

I tried using def get(self) in the handler, but the variable is not being read. Is it possible to use self.request.get(‘variable’) in a def get(self)? Is there otherwise any way to pass a variable from a def post(self) to a def get(self)?

Below is most of the code that I am using. Apart from the code below, I am passing the results out to a template, which is then fetched once more using AJAX. That part works as expected.

// HTML code

<table class="query-results user">
<tbody>
{% autoescape on %}
{% for row in user_queries %}
<tr class="query-results">
  <td class="query-user">
    <img class="query-user-avatar" src="../img/avatars/{{ row.1 }}_32x32x32.png"><br />
  </td>
  <td class="query-main" data-queryid="{{ row.8 }}">
    <span class="query-title">{{ row.2 }}</span><br />{{ row.3 }}</br>{{ row.0 }} || {{ row.5 }} ago
  </td>
</tr>
{% endfor %}
{% endautoescape %}
</tbody>
</table> 

// AJAX – send variable to QueryTab Handler:

$("td.query-main").live('click', function(){
  var queryid = $(this).data("queryid");
    var dataString = 'queryId='+ queryid;
    $.ajax({  
      type: "GET",  
      url: "/querytab",  
      data: dataString,
      success: function () { alert("data sent: " + dataString) }
      });  
    return false;
});

Python Code:

class QueryTab(webapp2.RequestHandler):
  def get(self):
    query_id = self.request.get('queryId')

    fmt = '%Y-%m-%d %H:%M:%S'

    conn = rdbms.connect(instance=_INSTANCE_NAME, database='userPrefs')
    cursor = conn.cursor()
    cursor.execute('SELECT q.userNickname, a.avatar, q.queryName, q.queryDescription, q.queryValue, q.dateCreated, q.dateLastUpdated, q.activeFlag, q.uniqueId, q.entryID FROM queries AS q LEFT JOIN avatarPrefs AS a ON q.userNickname = a.userNickname WHERE q.activeFlag ="true" AND q.uniqueId = %s ORDER BY q.dateLastUpdated DESC LIMIT 6', (query_id))
    self_query = [[str(row[0]), str(row[1]), str(row[2]), str(row[3]), str(row[4]), str(timesince(datetime.strptime(str(row[5]), fmt))), str(timesince(datetime.strptime(str(row[6]), fmt))), str(row[7]), str(row[8]), str(row[9])] for row in cursor.fetchall()]

    template_file_name = 'templates/querytab.html'
    template_values = {
      'self_query': self_query,
      'query_id': query_id,
    }

    path = os.path.join(os.path.dirname(__file__), template_file_name)
    self.response.out.write(template.render(path, template_values))
    conn.close()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:24:41+00:00Added an answer on June 5, 2026 at 2:24 pm

    At the time, I wasn’t as adept yet with AJAX, so didn’t quite understand the callback functionality. What I ended up using was something along the lines of:

    $('td.query-main').live('click', function() {
      var queryid = $(this).data("queryid");
      var dataString = 'term=' + queryid;
      $.ajax({  
        type: "POST",  
        url: "/snippets",  
        data: dataString,
        success: function(data) {
          $('#query-focus').html(data);
        }
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

platform: django 1.0, google app engine, app-engine-patch , python 2.5.4 i am tring to
I have an application hosted on the Google App Engine platform. The application is
We are planning a web application to build on Google's App Engine platform. Is
Possible Duplicate: Choosing Java vs Python on Google App Engine We are going to
We are developing a prototype app on top of Google App Engine's platform, but
Windows XP, Python 2.5: hash('http://stackoverflow.com') Result: 1934711907 Google App Engine ( http://shell.appspot.com/ ): hash('http://stackoverflow.com')
I have created a web application hosted on Google App Engine (Java). Now my
how to move a Google Application Engine based website to Amazon platform? do i
Platform used : Microsoft Visual Studio 2010 (C#) Database : SQL Server 2008 R2
I'm on the process of designing a web application based on Google App Engine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.