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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:57:58+00:00 2026-06-08T15:57:58+00:00

Im creating a webapplication in django to which Im very new. what I want

  • 0

Im creating a webapplication in django to which Im very new.
what I want to do is on user click open a modal window (basically just an absloute positioned div) which contains a {% block some_content%} tag. This block should then contain either a log in form or a register form (or anything else). I want to load this using ajax (so that nothing is loaded in vain).

here is the part of my template where i want the stuff to appear:

    <div id="modal" style="position: absolute; top: 60px; left: 100px; height: 400px; width:700px; background: #777; z-index: 20">

        <a href="#" onclick="Dajaxice.my_site.tester1(test_callback, {'user_id': '{{ user.id }}'})"><div class="button">Test</div></a>
        <br />

        {% block test_content %}{% endblock test_content  %}
    </div>

and here is my ajax.py

    @dajaxice_register
    def tester1(request, user_id):
        print "test " + user_id
        #contenxt = Context({'items': range(2)})
        print "1"
        return_str = render_block_to_string('my_site/testr.html', 'test_content')
        print "7"
        return HttpResponse(return_str)

Im using snippet http://djangosnippets.org/snippets/942/

following the print “#” leads me to believe that this works all the way up to the

    return HttpResponse(return_str)

where nothing seems to happen, not even an error message.

forgot to include the template i want to load to the block:

    {% extends "my_site/header.html" %}
    {% load url from future %}

    {% block test_content %}
        <div style="background: red; height: 70%; width:90%">
            <span>HEJ!!!</span>
        </div>
    {% endblock test_content %}

if there is a better approach Ill be glad to know about it but remember, Im new to django so please go slow.

  • 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-08T15:58:00+00:00Added an answer on June 8, 2026 at 3:58 pm

    So, here is my solution:

    I have Dajax installed. The reason it didn’t work is below but here is a complete solution that works.

    html:

    <input type="button" name="testerbutton" value="Test" id="testerbutton" onclick="Dajaxice.my_site.tester1(Dajax.process);">
    <br />
    <div name="result" value="" id="result">
    

    ajax.py:

    @dajaxice_register
    def tester1(request):
        dajax = Dajax()
        str = render_to_string('my_site/testr.html')
        dajax.assign('#result', 'innerHTML', str)
        return dajax.json()
    

    testr.html:

    <div style="background: red; height: 70%; width:90%">
        <span>HEJ!!!</span>
    </div>
    

    And the most important part — something it appears I can only blame myself for: make sure you correctly import jquery.dajax.core.js in your header. Otherwise Dajax.process does nothing.

    Thanks @pyronic for the help.

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

Sidebar

Related Questions

I am creating a web application in django and I want to create a
I'm creating a webapplication in Python (and Flask) where a user can register with
I'm creating a web application installer using WiX. I want to allow the user
I am creating a web application that will have many users. Each user has
I am creating a web application in Java in which I need to run
I am creating a web application framework, in which I am providing support for
I am creating a web application which has a few management screens, where a
i was wondering what the main things were to avoid when creating an webapplication
I have a Java Project , for which I'm now creating a Web interface,
I'm creating a web application which loads tabs using AJAX. My problem is that

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.