0
나는 이제 다음 유식 표 ....검색 중 값
<table id="hor-zebra" summary="DIsh Information">
<thead>
<tr>
<th scope="col">Item Name</th>
<th scope="col">Item Price</th>
<th scope="col">Item Type</th>
<th scope="col">Quantity</th>
</tr>
</thead>
{foreach name=f1
item=k
from=$res}
<tbody><tr class="odd">
<td id="bn"> {$k->b_name}</td>
<td> {$k->b_price}</td>
<td> {$k->b_type}</td>
<td> {$k->b_quantity}</td></tr>
<tr><td><a href="javascript:remove()">Remove</a></td>
<td id="resId"></td></tr>
{/foreach}
</tbody></table>
에 표시하는 코드와 Ajax 코드는 ....
function remove(){
var http = GetXmlHttpObject();
http.onreadystatechange = function()
{
if(http.readyState==4)
{
document.getElementById("resId").innerHTML = http.responseText;
//alert(http.responseText);
}
}
var name = document.getElementById("bn").innerHTML;
alert(name);
var url = "index.php?menu=rmv&ajax=ajax&q="+name;
http.open('POST',url,true);
http.send(null);
}
이 문제는 var 이름이 첫 번째 항목 이름 만 반환하는지 여부입니다. 두 번째 또는 세 번째 클릭 여부 ......... 나는 제거하고자하는 이름이 필요합니다. 단 하나만 보여주는 경고 .... ...
귀하의 ID는 'resId'는 모든 요소에 대해 동일합니다. 루프 내의 모든 요소에 대해 고유 한 ID를 작성해야합니다. – Nitish
나는 그것을 얻지 못했다 .... 간단히 설명 할 수있다 ...... –
FYI, foreach 루프 내부에 개구부 tbody 태그가있다. –