당신이 적절한 JSON을 반환 할 수 있습니다 서버 측 응용 프로그램이 가정, 구현은 다음과 같이 될 것이다 :
을 :
$(".item").mouseenter(function(){
var postUrl = $(this).href;
// Get the JSON From server, and format the data into the box
$.getJSON(postUrl, function (data) {
showInfoBox(data);
});
});
showInfoBox = function(data) {
var ibox = $("#divInfoBox");
$(".name", ibox).html(data.name);
$(".description", ibox).html(data.description);
// More data injection here
ibox.show();
};
관련 HTML은 같은 것
<div id="divInfoBox">
<h3 class="name"></h3>
<p class="description"></p>
</div>
<.......>
<!-- list of the item that need database data !-->
<ul id="itemList">
<li><a href="/url/to/data?id=1">1</a></li>
<li><a href="/url/to/data?id=2">2</a></li>
<li><a href="/url/to/data?id=3">3</a></li>
</ul>
마우스 센터와 마우스 오버의 차이점은 무엇입니까? – Dirk
설명하기 어려운 단어를 사용하십시오. 여기에서 예제를보십시오. http://docs.jquery.com/Events/mouseover#fn – xandy