我有一大堆带有动态生成名称的单选按钮,如下所示:
<input type="radio" id="Red<?php echo $wineID; ?>" name="category<?php echo $wineID; ?>" value="Red" <?php if ($category == "Red") { ?>checked="true"<?php } ?>>
<label for="Red<?php echo $wineID; ?>">Red</label>
<input type="radio" id="White<?php echo $wineID; ?>" name="category<?php echo $wineID; ?>" value="White" <?php if ($category == "White") { ?>checked="true"<?php } ?>>
<label for="White<?php echo $wineID; ?>">White</label>
<input type="radio" id="Sparkling<?php echo $wineID; ?>" name="category<?php echo $wineID; ?>" value="Sparkling" <?php if ($category == "Sparkling") { ?>checked="true"<?php } ?>>
<label for="Sparkling<?php echo $wineID; ?>">Sparkling</label>
我需要获取选定的值并将其添加到我的 dataString 中以进行 ajax 调用以更新我的数据库。如何使用 jQuery 做到这一点?