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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:03:34+00:00 2026-06-11T12:03:34+00:00

I get some form values by ajax and post them to preview page. but

  • 0

I get some form values by ajax and post them to preview page. but I couldn’t get how to reach those values in my template file. here are my codes:

my ajax function:

$('#preview').click(function() {

        var title = $('#id_title').val(); // form input1
        var body = $('#id_body').val(); // forminput2

     var ajaxOptions = {
         type:'post',
         url : '/admin/post/preview/',//preview page's url which defined in urls.py
         data : {
             'title_preview' : title,
             'body_preview'  : body
         },
         success: function(){
             window.open("/admin/post/preview"); // to see preview of post in a new window
         },
         error: function(){
            alert('olmadı');
         }
     };


        $.ajax(ajaxOptions);

my view:

@require_POST
def preview(request):

    title_preview = request.POST.get('title_preview')
    body_preview = request.POST.get('body_preview')
    query = Post(titlePreview = title_preview,bodyPreview = body_preview,owner = request.user)
    query.save()

    return render_to_response('preview.html',{'post':query},context_instance=RequestContext(request))

but it doesn’t work. it seems blank page.I don’t know what is wrong.

  • 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-11T12:03:35+00:00Added an answer on June 11, 2026 at 12:03 pm

    You’re posting to your preview view, then when that returns successfully you are trying to open a separate window by calling the same URL again. But the second call doesn’t have any POST data, so naturally it won’t work. Your success function should do something with the data it’s already being passed, rather than trying to open a new URL.

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

Sidebar

Related Questions

I am trying to get some form data from POST method. Here's the code
I need to get some external data to form an output file name in
I'm trying to post some form data and return results but I am having
I'm struggling to get a $.ajax call to correctly send some form data to
I'm trying to use $.ajax to send some values to a php page which
I have a form with some input texts passed in GET, and i don't
I use VB to get data through my form. I have some optional fields
I get some data from an PHP-Script via AJAX and want to have the
I've already tried everything i know, but still can't get my checkboxlist checked values.
i call my asp.net page method like below code $.ajax({ type: POST, url: MyPage.aspx/GetItems,

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.