Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

Jquery post, test return data

This is mostly from the Jquery post example from the jquery site.
My goal is to send the login to the site, see what the results are.
if the results are what I want
I will post the data again and let it be redirected to the correct site.

First, I can not tell if it is even firing, I put a alert in the data but it did
not fire,
I would like to see the resuts and then be able to test some of the data.

Can someone see what I may have done wrong here ,and tell me how to
get the resulting and move forward.
<!DOCTYPE html> 
  <script src="http://code.jquery.com/jquery-latest.js"></script> 
<form action="http://brain.com/default.asp" id="Form1" >
username   <input type="text" name="username"  id="username" /><br /> 
password    <input type="text" name="password"  id="password"   /> <br />
   <input type="hidden" name="institution" value="brain"  id="institution" /> 
   make a graph <input type="submit" name="submit"  /> 
  <!-- the result of the search will be rendered inside this div --> 
  <div id="result"></div> 
  /* attach a submit handler to the form */ 
  $("#Form1").submit(function(event) { 
    /* stop form from submitting normally */ 
    /* get some values from elements on the page: */ 
    var $form = $( this ), 
        username = $form.find( 'input[name="username"]' ).val(),
        password = $form.find( 'input[name="password"]' ).val(),
        institution = $form.find( 'input[name="institution"]' ).val(),
        url = $form.attr( 'action' ); 
    /* Send the data using post and put the results in a div */ 
    $.post( url, { username: username , password:password, institution:institution  }, 

      function( data ) { 
            var content = $( data ).text()
         $( "#result" ).empty().append( content ); 
        // Experts-Exchange:
        // What  I want to do here is 
        // get the contents of results test them and 
        // post the data to another site and go there. 
      ); // post 

Open in new window

  • 3
  • 2
2 Solutions
could you confirm your page is on the same domain and protocol than the action url?
yahoolaneAuthor Commented:
The are on different domains.

it's not possible to do ajax call across different domains

you may use your server to download the data for you : http://snipplr.com/view/45553/proxyasp/
yahoolaneAuthor Commented:
Both are good results.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now