brianzet 0 Newbie Poster

Hi everybody

I want to append an id from my mysql database to jQuery.

I dont know how to figure this out in ANY way :-S :-(

This is my code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
													 
	$("li.card").hover(
		function () {
			$(this).append($("<div id='popup'>This is has id nr. <?php echo $id; ?></div>").fadeIn('fast'));
		}, 
		function () {
			$(this).find("div:last").remove();
		}
	);

});
</script>
</head>

<body>
<div id="container">

  <div id="content">
        
    <ul>
      <?php
        $q = mysql_query("SELECT * FROM text");
        while($r = mysql_fetch_assoc($q)){
          echo '<li class="card">'.$r['indhold'].'</li>';
					$id = $r['id'];
        }
      ?>
    </ul>
    
  </div>
  
</div>
</body>

Notice

$(this).append($("<div id='popup'>This is has id nr. <?php echo $id; ?></div>").fadeIn('fast'));

I'm aware of this is not possible, but you get what I'm trying to do, I hope.

Anyone can help me?