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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:54:38+00:00 2026-05-26T01:54:38+00:00

am new to django and jquery,I am searching for a ‘hello world’ sample for

  • 0

am new to django and jquery,I am searching for a 'hello world' sample for jquery using django1.3, Where hello world is returned as a string /json from the server to the client when user press a button or at loading of the page.

Note: I am using django1.3 and python 2.7.Sorry this is a very basic question.

I successed in a `shows a string “This is Hello World by JQuery” with out any view functions(using jquery only) .But am unaware of how to use view functions from jquery functions
If any one have idea please help me.Thanks in advance.om templates
I tried using following code snippets.

urls.py

(r'^hellofromserver/$',views.test),



def test(request):
    if request.method == 'GET':
        json = simplejson.dumps('hello world!')
        return HttpResponse(json, mimetype = 'application/json')

jqueyhelloserver.html:

<html>
<head>
<title>jQuery Hello World</title> 
<script type="text/javascript" src="{{STATIC_URL}}js/jquery-1.2.6.min.js"></script> 
</head> 
<body>
 .....

<script type="text/javascript">


 # how can I get'hello world' from test function(What is the sytax  )

    </script>     
<div id="msgid">
</div> 
</body>
</html>

How can I call the functions ‘test’ and ‘hellofromserver’ from jquery?(from templates).

  • 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-26T01:54:39+00:00Added an answer on May 26, 2026 at 1:54 am

    Finally I got a ‘hello’ from the server!

    urls.py:
    from django.views.generic.simple import direct_to_template
    
    (r'^hello/$',direct_to_template, {'template': 'jqueryserver.html'}),
    (r'^jqueryserver/$',views.jqueryserver),
    

    views.py:

    #other imports
    from django.views.decorators.csrf import csrf_exempt
    from django.core.context_processors import csrf
    from django.views.decorators.csrf import csrf_protect
    
    def jqueryserver(request):
        print "in jqueryserver"
        response_string="hello"
        if request.method == 'GET':
            if request.is_ajax()== True:
                return HttpResponse(response_string,mimetype='text/plain')
    

    jqueryserver.html

    <html>
    <head>
        <title>jQuery Hello World</title> 
        <script type="text/javascript" src="{{STATIC_URL}}js/jquery.js"></script>
    <script>
    
    
    $.ajax({
        type: "GET",
        url: "/jqueryserver/",
       success: function(data){
             alert(data);         
         }
    });
    
    </script>   
    </head> 
    <body>
    <form method ="GET" >
    <input type= "submit" id = "save" value ="Save" />
    </form>
    <div id= "test"></div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDITED I'm trying to use jquery/ajax to display data returned from a django method.
So I am pretty new to both Django and Javascript (I am using JQuery)
am new to jquery.I am doing some ajax using jquery in django. $(document).ready(function() {
I'm rather new to Django and I'm using Django 1.0. I have this: forms.py:
I'm totally new to django, and I'm using its documentation to get help on
I'm implementing a Google Suggest like autocomplete feature for tag searching using jQuery's autocomplete.
I've gotten this json object back from django. I was wondering how do we
sing django and jQuery I am trying to implement a button that, using the
I am evaluating using CouchDB in my new Django-project. Is there a good database
I am quite new to Django and jquery stuff. I am trying to populate

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.