获得价值使用AJAX [英] Get value usign AJAX
本文介绍了获得价值使用AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我正在尝试获取显示值的值,这是男孩名字和女孩名字 - 我有一个按钮显示每个名字,用户可以选择。
目前,我可以点击按钮,但它给我'未定义'
有人可以帮忙吗?
我尝试过:
Hi
I am trying to get value of displayed values, which are boy names and girlsnames - i have a button displaying against each name, in which user can select.
At the moment, i can click the button but it is giving me 'undefined'
can someone help?
What I have tried:
$i = 0;
while($i < $count) {
echo '<tr>';
if(isset($arr['BoysName'][$i])) { echo '<td>'.$arr['BoysName'][$i].'<button type="button" value="favourites" id="favourites"</button><div style="float:right;"> ♥</td>'; }
else{ echo '<td class="noBorder"> </td>'; }
if(isset($arr['GirlsName'][$i])) { echo '<td>'.$arr['GirlsName'][$i].'<div style="float:right;"> ♥</td>'; }
else{ echo '<td class="noBorder"> </td>'; }
echo '</tr>';
$i++;
}
echo '</table></center>';
}
?>
<script>
$(document).ready(function() {
$("button").click(function(e) {
e.preventDefault();
var answerid = $(this).prop('i');
alert(answerid);
});
});
</script>
推荐答案
i = 0;
while(
i = 0; while(
i<
count){
echo'< tr>';
if(isset(
count) { echo '<tr>'; if(isset(
这篇关于获得价值使用AJAX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文