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

The Archive Base Latest Questions

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

i have a html page, which contains a form and i want when the

  • 0

i have a html page, which contains a form and i want when the form is successfully submited, show the below div:

<div class="response" style="display: none;">
  <p>you can download it<a href="{{ link }}">here</a></p>
</div>

i also have a jquery function:

    <script type="text/javascript">
        $(function() {
            $('#sendButton').click(function(e) {            
                e.preventDefault();
                var temp = $("#backupSubmit").serialize();
                validateForm();
                $.ajax({
                    type: "POST",
                    data: temp,
                    url: 'backup/',
                    success: function(data) {
                        $(".response").show();
                    }
                });
            });
        });

</script>

and in my views.py (code behind) i create a link and pass it to html page. i have:

def backup(request):
    if request.is_ajax():
        if request.method=='POST':
            //create a link that user can download a file from it. (link)
            variables = RequestContext(request,{'link':link})
            return render_to_response('backup.html',variables)
        else:
            return render_to_response('backup.html')
    else:
        return render_to_response("show.html", {
            'str': "bad Request! :(",
            }, context_instance=RequestContext(request))
backup = login_required(backup)

my problem: it seems that my view doesn’t execute. it doesn’t show me the link that i send to this page. it seems that only jQuery function is executed. i’m confused. how can i make both of them to execute(i mean jQuery function and then the url i set in this function which make my view to be executed.)

i don’t know how to use serialize function. whenever i searched, they wrote that:

The .serialize() method creates a text string in standard URL-encoded notation and produces query string like “a=1&b=2&c=3&d=4&e=5.

i don’t know when i have to use it, while i can access to my form field in request.Post[“field name”]. and i don’t know what should be the data which is in success: function(data) in my situation.

thank very much for your help.

  • 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-11T14:17:30+00:00Added an answer on June 11, 2026 at 2:17 pm

    You have to get and display the data from your ajax post function, where data is the response you render through your DJango server, for example:

    t = Template("{{ link }}")
    c = Context({"link": link})
    t.render(c):
    

    Your JS / jQuery should become something like this:

    <script type="text/javascript">
        $(function() {
            $('#sendButton').click(function(e) {            
                e.preventDefault();
                var temp = $("#backupSubmit").serialize();
                validateForm();
                $.ajax({
                    type: "POST",
                    data: temp,
                    url: 'backup/',
    
                    success: function(data) {
                        // 'data' is the response from your server
                        // (=the link you want to generate from the server)
    
                        // Append the resulting link 'data' to your DIV '.response'
                        $(".response").html('<p>you can download it<a href="'+data+'">here</a></p>');
    
                        $(".response").show();
                    }
                });
            });
        });
    </script>
    

    Hope this helps.

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

Sidebar

Related Questions

In the following HTML page, I have a div, which contains two spans (
I have an html page which contains a div that displays the html from
I have an html page called search.html which contains sliders, they work perfectly in
I have this html page which is very simple, it contains a text box
I have a page which contains a html.RenderPartial, that renders an ASP.NET MVC partial
I'm pretty new to PHP and have a String which contains an HTML page.
I have a html page which consist of a table & I want to
I have a page which contains several forms. I want to add a single
I have a HTML form that contains many links (around 17). I want, when
I have an HTML page which contains an Object tag to host an embedded

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.