0

次の問題があります。

var xmlhttp = new getXMLObject();   //xmlhttp holds the ajax object

$(function() {
$('a.popper').hover(function(e) {


 if(xmlhttp) {

xmlhttp.open("GET","DokterWeek_KlantoverzichtServlet?" + $("a.popper").prop("href").split("?")[1],true);//gettime will be the servlet name
xmlhttp.onreadystatechange  = handleServerResponse;
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(null);
}

上記のように、機能する a href class="popper" にカーソルを合わせると、サーブレットのパラメーターを取得することがわかります。しかし、問題は、foreach ループで常に最後の "a href" パラメーターを取得することです...

 <c:forEach items="${row}" var="cell">

<a href="./DokterWeek_KlantoverzichtServlet?AfspraakID=${cell.afspraakId}&Id=${cell.id}&KlantId=${cell.klant.id}" 
class="popper" data-popbox="pop1">

<c:forEach items="${row}" var="cell">

ホバーしたときにa href値LIVEを取得できるjavascriptまたはjqueryの可能性はありますか...これらのリンクにホバーすると、ブラウザーはパラメーターの変更を確認しますが、javascriptはそれをフェッチしません..Javascriptが最初に取得しますまたはループ内の最後のahref...

Plsは私を助けてください、私は2日以上解決策を探していました:(

4

2 に答える 2

0

この場合href、ホバーされた要素の を取得する必要があります。これは、$(this)

xmlhttp.open("GET","DokterWeek_KlantoverzichtServlet?" + $(this).prop("href").split("?")[1],true);//gettime will be the servlet name

注: jQuery を使用しているため、raw を使用する代わりに$.ajax()ユーティリティを使用して ajax 呼び出しを行ってください。XmlHTTPRequest

于 2013-05-08T11:24:02.833 に答える