JQUERY pass value from link and return it or forward it
<p>I am trying to:</p>

<p>click on the link shown below and have the value passed to an JQUERY $.get (I think it has to be done like that) and this should be made available to a SQL snippet which will include it its WHERE clause.</p>

<p>LINK</p>

<pre><code>$sOutput .= '"&lt;a href=\"#whatever?' .addslashes($aRow['id_cruise']) .'\" class=\"flip\"&gt;'.addslashes($aRow['from_country']).'&lt;/a&gt;",';
</code></pre>

<p>When I click on the link, you see that Flip class. That does open alright a slide pannel within which I have a div that would be populated after a SQL query works with the value sent:</p>

<p>JQUERY SNIPPET</p>

<pre><code>&lt;script type="text/javascript"&gt; 
$(document).ready(function(){
$('a.flip').live('click',function(){
    $(".panel").slideToggle("slow");

  });
});
&lt;/script&gt;
</code></pre>

<p>As you can see, it uses the LIVE function so that up on clicking indeed activates the slide pannel open. But I need that last bit more, the one that sends the value (of id_cruise). When I hover down the rows, I can see that the value of ID changes, which is great, but however I am not getting to make it passed to the snippet and picked up by the SQL query.</p>

<p>So I can see that in the link, where I write "whatever", indeed it doesnt matter, as long as it has the # sign. Note that the Link is part of the server processing file, whilst the JQUERY is on the user visible page file, they are in two different pages.</p>

<p>UPDATED FROM HERE, INCLUDING NOW THE CODE FROM JEFF:</p>

<p>The link looks so now:</p>

<pre><code>$sOutput .= '"&lt;a href=\"#id?' .addslashes($aRow['id_cruise']) .'\" class=\"flip\"&gt;'.addslashes($aRow['from_country']).'&lt;/a&gt;",';
</code></pre>

<p>Jeff wisely indicated how there should be a third file which would get the parameter from the second JQUERY snippet, return it and this second would pass it to a third one located just below. This third snippet is the one that forwards it to the DIV box located inside the slide panel.</p>

<pre><code>&lt;script type="text/javascript"&gt; 

$(document).ready(function(){
$('a.flip').live('click',function(){
$(".panel").slideToggle("slow");
      DoSomethingWith(this.id);

     });

});
&lt;/script&gt;


 &lt;script type="text/javascript"&gt;

function DoSomethingWith(id) {
  $.get("SendIdToDatabase.php", {idCruise: id}, AnotherFunction);
}
function AnotherFunction(str) {
  $("#reviews").html(str);
}
&lt;/script&gt;
</code></pre>

<p>OTHER CONTRIBUTOR SAID THAT IT COULD BE MERGED AND SIMPLIFIED INTO THIS:</p>

<pre><code>$(function() {
      $('a.flip').live('click',function() {
            $('.panel').slideToggle(slow');
            $('#reviews').load('SendIdToDatabase.php', {idCruise: this.id});
      });
});
</code></pre>

<p>SO NOW I CREATE THE PHP CODE (SendIdToDatabase.php) THAT WILL HANDLE THE SQL REQUEST</p>

<pre><code> &lt;?php


$id_crucero = $_REQUEST['id_cruise']; //this is what I (hopefully) should get from the page
              require ('mysqli_connect.php');

                    $sql ="SELECT description
                        FROM cruises
                        WHERE id_cruise
                        = '".$id_crucero."'";

                        $result = @mysql_query ($sql);

                    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {


                    $reviews = ($row['description']);
                    echo "$reviews";
                    }        

                      ?&gt;
</code></pre>

<p>AND FROM HERE IT SHOULD ECHO IT TO THE SECOND AJAX CODE SNIPPET WHICH FORWARDS IT TO THE PANEL (WHICH I HAVE RENAMED TO "REVIEWS" AND IT IS A DIV, NOT AN HTML)</p>

<p>BUT SOME LINK MUST BE BUGGY AS AT SOME POINT THE VALUE IS NOT PASSED OR RECEIVED.</p>

<p>AS OF 1 DECEMBER THE VALUE IS STILL NOT PASSED ON. I HARDCODED SOME TEXT IN THE PHP SCRIPT AND YES, THAT IS SHOWN IN THE DIV BOX INSIDE THE PANEL BUT IT DOES NOT SHOW THE VALUE</p>
