dimanche 28 septembre 2014

How to show other database information with onmouseover?


Vote count:

0




Little question for you. I've got a MySQL database and am able to retrieve information and show it on my index page. (see below). You can see that height, brand and model are in a single row.



<table class="mGrid" id="jsondata">
<thead>
<th>height</th>
<th>brand</th>
<th>model</th>
</thead>
<tbody></tbody>
</table>
</div>

<script type="text/javascript">

$(document).ready(function(){
var url="data_retrieval.php";
$("#jsondata tbody").html("");
$.getJSON(url,function(data){
$.each(data.uploads, function(i,user){
var newRow =
"<tr>"
+"<td>"+user.height+"</td>"
+"<td>"+user.brand+"</td>"
+"<td>"+user.model+"</td>"
+"</tr>" ;
$(newRow).appendTo("#jsondata tbody");
});
});
});

</script>


When a mouse goes over that row, I would like other information from the database to appear in the rest of the page. I'm not entirely sure if I need an onmouseover event or how to place it in this context.


I think what I need to begin with is setting up another div in the html, like this,



<table class="mGrid" id="jsondata">
<thead>
<th>height</th>
<th>brand</th>
<th>model</th>
</thead>
<tbody></tbody>
</table>
</div>

<table class="mGrid" id="jsondata1">
<thead>
<th>other info</th>
<th>other info</th>
<th>other info</th>
</thead>
<tbody></tbody>
</table>
</div>


but with the js I'm a bit more lost and that's where I need some assistance. Much thanks in advance.



asked 50 secs ago







How to show other database information with onmouseover?

Aucun commentaire:

Enregistrer un commentaire