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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:17:14+00:00 2026-06-14T14:17:14+00:00

edit When I write print request.POST[‘video’], nothing gets printed in the console even through

  • 0

edit

When I write print request.POST[‘video’], nothing gets printed in the console even through there is a value for ‘video’. Am I incorrectly getting the wrong value in the javascript? I am trying to get the ‘video34’ (the value in the hidden field) to show up.

original

I am trying to POST data using jQuery/AJAX in Django and am having trouble. How do I access the ‘video’ variable in the views.py? When I write ‘print video’ in views.py, I get an error in the console saying POST /edit_favorites/ HTTP/1.1" 500 10113.

views.py

from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt

@csrf_exempt
def edit_favorites(request):
    if request.is_ajax():
        message = "Yes, AJAX!"
    else:
        message = "Not Ajax"
    return HttpResponse(message)

urlconf:

url(r'^edit_favorites/', 'edit_favorites'),

html:

<form method='post' id ='test'>
     <input type="hidden" value="video34" />
    <input type='submit' value='Test button'/>
    
    <div id = 'message'>Initial text</div>
        
</form>

javascript:

<script type="text/javascript">
   $(document).ready(function() {
       $("#test").submit(function(event){
       event.preventDefault();
            $.ajax({
                 type:"POST",
                 url:"/edit_favorites/",
                 data: {
                        'video': $('#test').val() // from form
                        },
                 success: function(){
                     $('#message').html("<h2>Contact Form Submitted!</h2>") 
                    }
            });
            return false;
       });
       
    });
</script>
  • 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-14T14:17:16+00:00Added an answer on June 14, 2026 at 2:17 pm

    It’s in request.POST['video'], just like in a normal POST.

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

Sidebar

Related Questions

i have to make a notepad where i write,edit,clear the text. this notepad need
I would like to write a script which will edit multiple XML files, I
How do you write a method/message with multiple parameters? EDIT: Like multiple parameters for
I just write a simple program to print the address of variable. #include <stdio.h>
import sys import matplotlib import matplotlib.pyplot as plt print matplotlib.__version__, matplotlib.get_backend() def hit(event): sys.stderr.write('hit\n')
Per request, there are a few different ways that you can tell whether or
(Edit: randrange is just random.randrange, I didn't write my own RNG) I'm trying to
I try to read and write a cell in google spreadsheet with http request
EDIT : I completely re-wrote the question since it seems like I was not
EDIT: a few weeks after I posted this question Evan Coury wrote an excellent

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.