我在成功调用 ajax 时尝试填充每个项目 real_price。它所做的是将每个项目的所有 real_price 标签填充到服务获取的最后一个值。
如何重写它以一次填充 1 个,以便每个项目都有其特定价格?
<div class="item">
<p class="price">$388.00</p>
<p class="part_number">VM2327T23A00T</p>
<p class="real_price"></p>
</div>
<div class="item">
<p class="price">$88.00</p>
<p class="part_number">AA327T23A00T</p>
<p class="real_price"></p>
</div>
<div class="item">
<p class="price">$38.00</p>
<p class="part_number">AA327T23A00T</p>
<p class="real_price"></p>
</div>
<script>
jQuery('.part_number').each(function () {
jQuery.ajax(
{
type: "POST",
url: "RealTimePricing.aspx/GetRealPrice",
data: "{pmber:' " + SearchSpring.jQuery(this).text() + "', lrice: ' " + jQuery(this).siblings('.price').text() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function (msg) {
//NEED TO CHANGE SOMETHING HERE
jQuery('.real_price').html(msg.d);
</script>