I am not able to set custom attributes value with ajax success response in current selected select box.
I want to set ajax success response value in current selected selectbox.
Here is my code ..
HTML
<tr>
<td>
<select class="promo_code_box selected" id="promo_code_box">
<option product_price="27.90" value="5"> 5% OFF</option>
<option product_price="27.90" value="10"> 10% OFF </option>
<option product_price="27.90" value="15"> 15% OFF </option>
<option product_price="27.90" value="20"> 20% OFF </option>
<option product_price="27.90" value="25"> 25% OFF </option>
<option product_price="27.90" value="30"> 30% OFF </option>
</select>
<p class="update_promo_price" id="update_promo_price"></p>
</td>
</tr>
<tr>
<td> Same HTML here...</td>
</tr>
<tr>
<td> Same HTML here... </td>
</tr>
JQuery Ajax Call
$(document).ready(function(){
$('body').on('change','.promo_code_box',function(){
$.ajax({
type: "POST",
url: 'get_promo_price_level.php',
data: {'promo_code':$(this).val(),'origional_price':$('#product_origional_price').val(),},
success: function(response)
{
var jsonData = JSON.parse(response);
promoDiscount = jsonData.data;
$(this).parent().attr("update",jsonData.data); // Not work
$(this).next().html(jsonData.data); // Not work jasan data not added in update_promo_price
}
});
});
});
In HTML there are tr
td
structure , Mean to say same select box html in each table row. So I want once change select box from particular table's row then ajax
success value will be store into current select box's next element update_promo_price
. I have tried everything is working fine but ajax success response value will not add into current select box next element.