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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:30:55+00:00 2026-06-13T15:30:55+00:00

Building a site so users can add topics onto a site and ask then

  • 0

Building a site so users can add topics onto a site and ask then Q&A. Using AJAX, the “Add Media” button on the home page loads my Add Media Form (text and an image) to the site. The box is rendering fine with the correct forms, but after hitting Submit the form doesn’t save in the database. When just rendering the form onto a new HTML page without jquery, the model works just fine and the input is saved. How do I get the information submitted in a jquery lightbox to be saved in the database too?

So this is the html page

#home.html
<a href="#login-box" class="btn btn-success">Add Media</a>  
        <div id="login-box" class="addmovie-popup">

This is the jquery that goes with it

#home.js
$(document).ready(function() {
    $('.block3 a').click(function(ev) {
        ev.preventDefault();
        var url = $(this).attr('href');
        $('#login-box').load('http://127.0.0.1:8000/home/add_movie/');
    });
}); 

The URL conf

#urls.py
url(r'^add_media/$', 'add_media'),

The view for adding media

#views.py
def add_media(request):
    if request.method == "POST":
        form = MediaForm(request.POST, request.FILES)   
        if form.is_valid():
            form.save(user = request.user)
            return HttpResponseRedirect("/home//")
    else:
        form = MediaForm()
        return render_to_response("qanda/add_media.html", {'form': form}, context_instance = RequestContext(request))

And the HTML form that it is rendering

#add_media.html
<h1> Add Media:</h1>
<form enctype = "multipart/form-data" action = "" method = "post">{% csrf_token %}
    {{ form.as_p }}
    <input type = "submit" value = "Add" />
    <input type = "hidden" name = "next" value = "{{ next|escape }}" />
</form>
  • 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-13T15:30:58+00:00Added an answer on June 13, 2026 at 3:30 pm

    If you’re loading HTML into your page dynamically action = "" would point to the current page, which clearly doesn’t handle your POST requests.

    Set the action to the correct URL.

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

Sidebar

Related Questions

I'm building a site where registered users can upload files. Those files are then
I'm building a site using PHP which allows users to add in a lot
I'm building a site were users can upload images and then use them. What
I am building a site that is permissions based. The user can add or
All the content on a site I am building is loaded dynamically using ajax
i'm building a simple site where users can post comments about things. What I
I’m building a site that needs users created with different roles and permissions to
I'm building a site with django that lets users move content around between a
I'm currently designing a comments table for a site I'm building. Users will be
We are building a site using asp.net mvc. We want to allow the user

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.