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

  • Home
  • SEARCH
  • 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 8089757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:30:20+00:00 2026-06-05T19:30:20+00:00

here is my code: urls.py: from django.conf.urls import patterns from views import show,showpage urlpatterns

  • 0

here is my code:

urls.py:

from django.conf.urls import patterns
from views import show,showpage

urlpatterns = patterns('',
                       (r'^$',showpage),
                       (r'^show/$',show),
)

views.py

from django.http import HttpResponse
def show(request):
  arr = reqeust.GET.get('arr','Nothing')
  print arr#**it's 'Nothing'**
  if arr == 'Nothing':
    msg = 'fail'
  else:
    msg = 'pass'
  return HttpResponse(msg)

def showpage(request):
  html = '''    <html>
<head>
<script language="javascript" type="text/javascript" src="/site_media/js/jquery-1.7.2.js"></script>
</head>
<body>
<input type="button" id="input_btn"/>
</body>
<script language="javascript" type="text/javascript">
$(function(){
  $("#input_btn").bind("click",function(){
    arr = [1,2,3,4,5,6]
    $.ajax({
      type:"GET",
      url:"/show/",
      data:{arr:arr},//**I want pass the arr to django**
      success:function(data){alert(data);},
      error:function(data){alert(data);}
    });
  });
})
</script>
</html>'''
  return HttpResponse(html)

when I access localhost:8000,and click the button,I got ‘Nothing’ printed in the backend console,as you know I got message ‘fail’ in the frontend

uh..can anybody sovle this problem,I want get the code (arr = reqeust.GET.get('arr','Nothing')) which return a list([1,2,3,4,5,6]) or something like this

———append1——-

I got this in the console when I click the btn

[12/Jun/2012 09:48:44] “GET /show/?arr%5B%5D=1&arr%5B%5D=2&arr%5B%5D=3&arr%5B%5D=4&arr%5B%5D=5&arr%5B%5D=6 HTTP/1.1” 200 4

———apend2——-

I fixed my code like this:

arr = request.GET.get('arr[]','Nothing')

and I got 6 which is the last one of the javascript array,how can I get the whole array?

thanks advance!

  • 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-05T19:30:21+00:00Added an answer on June 5, 2026 at 7:30 pm

    jQuery has decided to add square brackets to the field name, most likely to accommodate PHP. They aren’t required for Django, but whatever. Access request.GET['arr[]'] and request.GET.getlist('arr[]') instead.

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

Sidebar

Related Questions

Here is a part of my html code (video urls marked with a django-template
here is code that I have: agent = Mechanize.new page = agent.get 'http://google.com' page.save
Here is code from MSDN . I don't understand why the work isn't just
I wrote some code to download some files from URLs, which I put in
I'm using the following code on my iPhone app, taken from here to extract
here's my code snippet to start with: $url = $_SERVER[REQUEST_URI]; // gives /test/test/ from
Here's code from https://github.com/Khan/khan-exercises/blob/master/khan-exercise.js for ( var i = 0; i < loading; i++
I've got a weird problem here: I'm getting a 500 error code from Apache
Ok the error is showing up somewhere in this here code if($error==false) { $query
Here my code jQuery.fn.dataTableExt.oSort['num-asc'] = function(a,b) { var x = a.replace( /<.*?>/g, ); var

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.