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 311339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:54:57+00:00 2026-05-12T07:54:57+00:00

What I am trying to do is pretty simple: yet something has clearly gone

  • 0

What I am trying to do is pretty simple: yet something has clearly gone awry.

On the Front-End:

function eval() {
    var x = 'Unchanged X'
    $.get("/",  { entry: document.getElementById('entry').value },
          function(data){
            x = data;
          }
      );

       $("#result").html(x);
    }

On the Back-End:

class MainHandler(webapp.RequestHandler):

  def get(self):
      path = os.path.join(os.path.dirname(__file__), 'index.html')
      if self.request.get('entry') != '':
          #self.response.out.write({'evalresult': self.request.get('entry')})
          self.response.out.write(request.get('entry'))
      else:
          self.response.out.write(template.render(path, {'result': 'Welcome!!'}))



   def main():
      application = webapp.WSGIApplication([('/', MainHandler)],
                                       debug=True)
      wsgiref.handlers.CGIHandler().run(application)

Yet, apparently the function is never being called and #result gets set to ‘Unchanged X’. What am I missing?

NOTE: The callback is NOT being called. I have verified this by placing an alert(“Test”) within the callback function. Any ideas anyone?

  • 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-05-12T07:54:57+00:00Added an answer on May 12, 2026 at 7:54 am

    First we have the silly mistake:

    <font size="3" face="Trebuchet MS">Speak Your Mind:&nbsp;&nbsp;</font><input type="text"     
    size="60" id="entry"/> <img valign="bottom" src='/assets/cognifyup.png' 
    onMouseOver="over()" onMouseOut="out()" onMouseDown="out(); evaluate();" 
    onMouseUp="over()"><br><br>
    

    Semicolons are required after the calls to over() and out() (roger that? — sorry couldn’t resist)

    Secondly (the much more subtle problem):

    If we ever need intend to translate the get() into a getJSON() call, (which you might have noted was my original intent from the commented python code that returns a dict), then we need to wrap a str() call around self.request.get('entry'). Hence,

    self.response.out.write({'evalresult': self.request.get('entry')})

    becomes:

    self.response.out.write({'evalresult': str(self.request.get('entry'))})

    As strings from an HTML field translate to unicode text in Python, at the back-end, we apparently need to convert it to a Python string (as getJSON() apparently doesn’t like Python’s representation of a unicode string — any ideas why this this is the case anyone?).

    At any rate, the original problem has been solved. In conclusion: any JSON object with a Python unicode string will not be accepted as a valid JSON object and will fail silently — a nasty gotcha that I can see biting anyone using JQuery with Python on the server-side.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 238k
  • Answers 238k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer functions declared on a base object's prototype are inherited by… May 13, 2026 at 6:53 am
  • Editorial Team
    Editorial Team added an answer Here is a sample: Excel.Application oXL; Excel._Workbook oWB; Excel._Worksheet oSheet;… May 13, 2026 at 6:53 am
  • Editorial Team
    Editorial Team added an answer This page on the Python wiki highlights the main differences… May 13, 2026 at 6:53 am

Related Questions

i am trying to do a groupby in linq, basically i have a list
I am pretty new to php and could sure use some help understanding how
I have created a WPF tooklit datagrid in C# and the ItemsSource is set
I know I'll get a thousand Depends on what you're trying to do answers,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.