Jquery post, test return data

Posted on 2011-10-05
Last Modified: 2012-05-12
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=""></script> 
<form action="" 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

Question by:yahoolane
    LVL 81

    Expert Comment

    could you confirm your page is on the same domain and protocol than the action url?
    LVL 1

    Author Comment

    The are on different domains.

    LVL 81

    Accepted Solution

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

    you may use your server to download the data for you :
    LVL 81

    Assisted Solution

    LVL 1

    Author Closing Comment

    Both are good results.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now