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

  • Home
  • SEARCH
  • 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 7082897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:06:41+00:00 2026-05-28T07:06:41+00:00

So Im trying to use jquery’s .post function to submit a form and return

  • 0

So Im trying to use jquery’s .post function to submit a form and return the results on the same page. I’ve tried using the example found in jquery’s documentation. The form is getting submitted successfully but nothing gets returned to the form page.

I have my JS set up like:

    <form id="test_form" method="post" action="test3.php">
        <input type="radio" name="zip" id="zip" value="10001" />
        <input type="radio" name="keyword" id="keyword" value="GPS" />
        <input type="submit" />
    </form>

    <div id="result" ></div>

    <script>
  /* attach a submit handler to the form */
  $("#test_form").submit(function(event) {

    /* stop form from submitting normally */
    event.preventDefault(); 

    /* get some values from elements on the page: */
    var $form = $( this ),
        zip = $form.find( 'input[name="zip"]' ).val(),
        keyword = $form.find( 'input[name="keyword"]' ).val(),
        url = $form.attr( 'action' );

    /* Send the data using post and put the results in a div */
    $.post( url, { keyword: keyword,  zip: zip },
      function( data ) {
          var content = $( data ).find( '#form_results' );
          $( "#result" ).empty().append( content );
      }
    );
  });
</script>

the relevant portion of the form script on test3.php looks like:

<div id="form_results">
<script type='text/javascript'><!--//<![CDATA[

   var m3_u = (location.protocol=='https:'?'https://mydomain.com/openx/www/delivery/rtl.php':'http://mydomain.com/openx/www/delivery/rtl.php');

   var m3_r = Math.floor(Math.random()*99999999999);

   if (!document.MAX_used) document.MAX_used = ',';

   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);

   document.write ("?zoneid=4");

   document.write ('&amp;cb=' + m3_r);



//you Should pass your Keyword

   document.write ('&amp;keyword=<?php echo urlencode($_POST["keyword"]);?>');

//you Should pass your Zipcode

 document.write ('&amp;zipcode=<?php echo urlencode($_POST["zip"]);?>');



   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);

   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));

   document.write ("&amp;loc=" + escape(window.location));

   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));

   if (document.context) document.write ("&context=" + escape(document.context));

   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");

   document.write ("'><\/scr"+"ipt>");

//]]>--></script><noscript><a href='http://mydomain.com/openx/www/delivery/ck.php?n=a9d134b1&amp;cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://mydomain.com/openx/www/delivery/avw.php?zoneid=4&amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;n=a9d134b1' border='0' alt='' /></a></noscript>
  </div>

What I am doing wrong here? Why doesn’t it return the results into the #result div? I’ve watched the headers, so I know that the data is getting passed successfully.

  • 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-05-28T07:06:42+00:00Added an answer on May 28, 2026 at 7:06 am

    If anyone is interested, I have discovered that there is no possible solution to this problem, short of implementing a hack like JSON-P. It doesn’t work because it violates the same-domain policy. Thanks to anyone who looked at this and attempted to figure out what was going on.

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

Sidebar

Related Questions

I am trying to use JQuery to submit a form without reloading the page.
I'm trying to use jQuery to submit a form so the page doesn't need
I'm trying to use jquery to submit my form like so but it's not
Im trying to use jquery and ajax to submit a form and show the
I am trying to use jQuery Ajax in my form to submit... Here is
I'm trying to use jQuery UI tabs much like a Master Page in ASP.Net.
I am trying to use jQuery to fade out a div, using the fadeOut
im trying to use jquery tools tooltip ( http://flowplayer.org/tools/tooltip.html#events)on a form to show hints
im trying to use jquery bbq for remembering page with ajax. but i wonder,
I'm trying to use jQuery to fill in a form in an iFrame. Do

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.