Passing Data to an AJAX Call

Passing Data to an AJAX Call

Hey all so Im trying to put data through an AJAX call into this div

  1.             <div class="scroll-pane2 blue small" style="">
  2.                 <p id="bulletinBodyArea" style="margin-right:20px;"></p>   
  3.             </div>

The AJAX is being triggered when one clicks on one of the links being fed from the database

  1.             <div class="bulletinSectionAccordion rounded">
  2.                 <p class="blue" style="font-size:19px;margin-left:23px;margin-top:15px;margin-bottom:10px;">Archives</p>
  3.             <?php
  4.                 $query = "SELECT * FROM `bulletin`  LEFT JOIN `bulletininschool` ON `bulletin`.`id`=`bulletininschool`.`bulletin` WHERE `school` = 2 ";
  5.                 $result=$connection->query($query);
  6.               while($row = $result->fetch_array()) {
  7.                 echo  '<p class="medium titi" style="margin-left:23px;">'.$row['title'].'</p>';
  8.               }
  9.             ?>
  10.             </div>

It gets called and then passes the data

  1.       $(".titi").click(
  2.             getBody
  3.       );
  4.    
  5.         function getBody(){
  6.           $("#bulletinBodyArea").load('update/getBody.php');
  7.         };

And this is the AJAX function

  1.     <?php
  2.     $section='bulletin';
  3.     $table="bulletin";
  4.     $schoolSelectorTable="bulletininschool";
  5.     $schoolSelector="bulletin";
  6.    
  7.         $db_host = "localhost";
  8.         $db_user = "root";
  9.         $db_pass = "";
  10.         $db_name = "isl";
  11.    
  12.    
  13.     mysql_connect($db_host, $db_user, $db_pass, $db_name);
  14.     mysql_select_db("isl") or die(mysql_error());
  15.    
  16.    
  17.     $states = mysql_query("SELECT * FROM `bulletin` LEFT JOIN `bulletininschool` ON `bulletin`.`id`=`bulletininschool`.`bulletin` WHERE `school` = 2" );
  18.    
  19.    
  20.     while($state = mysql_fetch_array($states)){
  21.         echo "<p>".$state['body']."</p>";
  22.     }
  23.     ?>

Now the links that one clicks that are fed from the database are actually article titles, and then when one clicks on a specific title the AJAX call should go and fetch the body text associated with that article. But I'm having trouble understanding how I should go through that. I'm doing the correct queries and getting the titles and the bodies but I just cant figure out how to associate them. Do I pass a variable to the AJAX call?

Thank you