我想在 ajax 调用中显示用户选择的数据。
场景是我有两个单选按钮,当用户单击其中一个按钮时,它应该在右侧的响应 div 中显示相应的数据。
HTML:
<form id="package-call" method="post" accept-charset="utf-8">
<div class='pakges'>
<div class="sub-pakge">
<div class="sub-pakge-content">
<span class="content-title">North America</span><br>
<span class="content-title">Basic</span>
<div class="content-time">150 Minutes</div>
<span class="content-price">Rs.500</span>
<div class="pakges-radio"><input type="radio" name="package" id="package" > </div>
</div>
</div>
<div class="sub-pakges">
<div class="sub-pakges-content">
<span class="content-title">North America</span><br>
<span class="content-title">Max</span>
<div class="content-time">400 Minutes</div>
<span class="content-price">Rs.200</span>
<div class="pakges-radio"><input type="radio" name="package" id="package"> </div>
</div>
</div>
</div>
</form>
阿贾克斯:
$("#package").click(function(e){
$.ajax( {
type: "POST",
url: "package _selection.php",
data: $('#package_call').serialize(),
success: function( response ) {}
});
});
这是我要显示我的回复的 div:
<div class="form-results">
<div class="rslt-content-main">
<div class="rslt-content">Selected Pakages / Bolts</div>
<div id="package_response"></div>
</div>
</div>
这些是我想通过包 _selection.php 的 ajax 调用并希望分别显示的结果 div
<div class="radio_one_rslt">
<div>voice:</div><br />
<div>IDD Asia - Rs 200</div>
</div>
<div class="radio_two_rslt">
<div>voice:</div><br />
<div>IDD Asia - Rs 500</div>
</div>