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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:52:52+00:00 2026-05-22T18:52:52+00:00

I am having an issue with using POSTed data instead of GET data with

  • 0

I am having an issue with using POSTed data instead of GET data with Django.

Here’s my simplified urlpatterns class:

urlpatterns = patterns('',
    ('^hello/$', hello),
    ('^hello/ajax_info/$', ajax_info),   
)

And I have this view in the views.py file:

def ajax_info(request):
    if request.method == "POST":
        print "This is a post"
    # do stuff    

The web page served up when you browse /hello/ has this javascript in it:

    function loadXMLDoc(name) {
        if (window.XMLHttpRequest) {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        } else {
            // code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }

        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
                //window.onload()

            }
        }

        // GET method
        //parm = values
        //xmlhttp.open("GET",name+"?q="+parm, true);
        //xmlhttp.send();

        // POST method
        parms = "data=" + values
        xmlhttp.open("POST", "ajax_info", false);
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
        xmlhttp.send(parms)
    } // end function loadXMLDoc

(in the web page I have a button that causes loadXMLDoc() to get called when you press it)

If I uncomment the “GET method” in the javascript, and comment out the “POST method” then my, django view gets called.

But if I comment out the “GET method” and use the “POST method” code, then my viewer doesn’t even get called. And the django dev server returns this:

[28/May/2011 00:15:06] "POST /hello/ajax_info HTTP/1.1" 500 69236

Am I missing something obvious? The examples seem to indicate that my request should get to my viewer even if they are POSTs.

  • 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-22T18:52:53+00:00Added an answer on May 22, 2026 at 6:52 pm

    I believe the problem is that your view method does not return anything … Try accesing the page /hello/ajax_info/ and check if everything is working properly!

    If this is the case, you will receive, with DEBUG = True, this error:
    “The view … didn’t return an HttpResponse object.”

    Also be sure you are using the “csrf_token” tag if you are POSTing something … Cookies must be on!

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

Sidebar

Related Questions

I am having some issue here using LWP::Simple to get ftp site content in
I'm having an issue with the following code: private void DataPortal_Fetch(TaskCriteria criteria) { using
I'm having an issue with temp tables using an ADO connection to my database.
I having an issue from my HTTP Post. The code I'm using are working
I am having an issue deploying a flask app on apache2 using wsgi. I
I'm having an issue using a custom helper method in my Rails (3.0) app
I am having an issue trying to post a JSON string using dojo.xhrPost to
I'm having an issue using Liferay Portal Community 5.2.3 according to timezones and time
I'm having an issue with a function I'm calling (using jQuery). My issue is
I'm having an issue with callbacks and it's probably something I'm doing. Using a

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.