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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:39:29+00:00 2026-05-25T21:39:29+00:00

Beginning to climb the ajax learning curve, I’m trying to make a simple ajax

  • 0

Beginning to climb the ajax learning curve, I’m trying to make a simple ajax call back to my CherryPy application and echo the data sent back to the browser.

My ajax call is working and I can return, for instance, the request method back to the browser.

I cannot, however, find the data sent by browser in the request object inside my CherryPy handler. Here is my CherryPy handler, cribbed from this question:

class Contact:

def index(self):

    cl = cherrypy.request.headers['Content-Length']
    rawbody = cherrypy.request.body.read(int(cl))
    body = None
    #body = simplejson.loads(rawbody)
    if body is None:
        return cherrypy.request.method + ' (no body found)'
    else:
        return cherrypy.request.method + ' ' + body


index.exposed = True

and here’s my Javascript:

<script type="text/javascript">
function SendContactEntry() {
$.ajax( {type:        "POST",
     url:         "/contact/",
     data:        { word: "HELLO" },
     processData: false,
     cache:       false,
     contentType: "application/json",
     dataType:    "text",
     success:     function (response){
                alert(response);
              }
    }
);
}
</script>    

Using this code my browser receives back a response of “POST (no body found)”.

What I want to do is learn, in my CherryPy handler, that I was sent a word value of “HELLO”.

If I uncomment the line body = simplejson.loads(rawbody) I receive an HTML Status of 500 back from CherryPy. The same happens if I try to decorate my index() function with @cherrypy.tools.json_in().

  • 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-25T21:39:30+00:00Added an answer on May 25, 2026 at 9:39 pm

    Since you have set processData to false and you are passing over an object you are sending over a stringified version of your data object – and there is nothing to see.

    Either:

    1. Call JSON.stringify on your data object before sending it over (which should make your simplejson.loads call work).
    2. Remove your processData attribute and let jQuery send the request over as a normal URL-encoded request (and you can access your variables through request.params["word"]).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Taking beginning Data Structures in C# class, trying to make a searchable arraylist of
I'm just beginning to use Python 2.7 and am trying to build a simple
I'm a beginning programmer who is trying to capture data from this source Here's
I'm beginning to climb the walls here. I've filled a combo box with a
I'm beginning a large scale javascript application with Marionette. A Marionette application has a
I am a beginning at nhibernate and I am trying to connect to a
Beginning Ruby Question: I'm trying to see if a string variable's contents is either
I am beginning a new Java web application using Netbeans, and I would like
I'm just beginning to grasp the setup of maven2 while porting over a simple
im in the beginning of the complete restyle of an my web application, and

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.