title: JQUERY load vs get
body: <p>I have this line of code</p>
  
  <pre><code>$('#findemail').load('findemail.php', {id: this.id, tabla: $(this).attr("rel")});
  </code></pre>
  
  <p>which loads alright the data in the anchor div. However, it turns out that I need to utilize that data, namely it displays an email address and I need to "grab" that email address and send it through a "hidden submit" from the webform to the mail processing script. That line above is sending two parameters, the ID and the tablename, that are used by a SQL query, which selects me the email I want to use, in the form of $destination_email</p>
  
  <p>Someone told me that in order to do that, I just need to use "get" instead of "load" like here below, but putting together that I am a bit retard and that I have about an hour "experience"  with JQUERY I dont know how to benefit from that code. My webform is some hundreds of lines below in that same page, so I dont know how to fully finish that JQUERY code so that I can fetch it from my HTML form to forward it, as I said. Please, if you want to help dont just give me a hint, I still dont know the syntax of JQUERY although I am struggling to learn as much as I can. The code is nearly finished anyway.</p>
  
  <p>The full code is here below. The first line does the load alright, it fills me a div box with that and that is all I need. But the second line, as I have explained, fetches an email address in the form of a variable, and I need to work with that, that is why it uses "get"</p>
  
  <pre><code>&lt;script type="text/javascript"&gt; 
  $(document).ready(function(){
  $('a.flip').live('click',function(){
      $(".panel").slideToggle("slow");
  
  
  $('#reviews').load('SendIdToDatabase.php', {id: this.id, tabla: $(this).attr("rel")});
  
  
  
  $.get('findemail.php', {id: 'findemail', tabla: $('#findemail').attr('rel')}, function(data) {
        // data contains the response
  }); 
  
  
  
    });
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>UPDATE TO 99,99% FINISHED CODE</p>
  
  <p>HERE is what I have. It seems fine to me, however, hm, still is not sending that email away</p>
  
  <p>only below the dotted line is interesting, the rest works perfect. Below the dotted line is the code that fetches the email. It does load it perfect, it displays it so as if hardocoded on the surface of my HTML form as alvaro@mygmail.com but there probably is very minor thing impeding that to be passed on.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt; 
  
  
  $(document).ready(function(){
  $('a.flip').live('click',function(){
      $(".panel").slideToggle("slow");
  
  
  $('#reviews').load('SendIdToDatabase.php', {id: this.id, tabla: $(this).attr("rel")});
  ................................................................................
  
  
  $('#findemail').load('findemail.php', 
                     {id: this.id, tabla: $(this).attr("rel")},
                     function() {
                       var email = $(this).find(".email").val();
  
                   });
  
            });
  
  
    });
  
  &lt;/script&gt;
  
  
  &lt;?php
  echo '&lt;div id ="findemail" class="email"&gt;';
  
  
  echo '&lt;input type="hidden" name = "country" class="email" value= "'.$destination_email.'"/&gt;';
  
  echo '&lt;/div&gt;';
  ?&gt;
  
  
  
  
  
  &lt;div id="form-submit"&gt;&lt;input type="submit" id="submit-form" name="submit" value="Submit" /&gt;&lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Grasping the idea from Nick</p>
  
  <p>it can also be that the SQL query issues not just an email alone, but the whole 
  
  <pre><code>echo '"&lt;input type = "hidden" val=\"' .addslashes($aRow['email']) .'\" class=\"email\" .&gt;"';
  </code></pre>
  
  <p>=======================================================================================</p>
  
  <p>So There seem to be 2 different solutions that you Brian and Nick are proposing:</p>
  
  <p>NICKS</p>
  
  <pre><code>$('#findemail').load('findemail.php', 
                     {id: this.id, tabla: $(this).attr("rel")},
                     function() {
                       var email = $(this).find(".email").val();
  </code></pre>
  
  <p>AND THEN THIS:</p>
  
  <pre><code>&lt;?php
  echo '&lt;div id ="findemail" class="email"&gt;';
  
  
  echo '&lt;input type="hidden" name = "country" class="email" value= "'.$destination_email.'"/&gt;';
  
  echo '&lt;/div&gt;';
  ?&gt;
  </code></pre>
  
  <p>AND THEN BRIANS:</p>
  
  <pre><code>var email = $('#reviews').html(); // this to grab the email
  </code></pre>
  
  <p>and here below embedded in my webform</p>
  
  <p>but, is the syntax correct ? where is the start of the <code>&lt;input&gt;?</code></p>
  
  <pre><code>$('#my-form').append($('&lt;input/&gt;').attr('type', 'hidden').val(email))
  </code></pre>