I have a function that will display the data in the closest tr
inside the api function. The problem is that they can't find the closest tr
. Here's my code:
$('.pricing_level').on('change', function(e){
var pricing_level_id = e.target.value;
$('tbody.subcontent tr').each(function(){
var item_id = $(this).closest('tr').find(".details_itemid").val();
var category_id = $(this).closest('tr').find(".details_category_id").val();
var subcategory_id = $(this).closest('tr').find(".details_subcategory_id").val();
var net_unit_price = $(this).closest('tr').find(".details_unitprice").val();
$.get('/dev/api/itempricinglevel?item_id=' + item_id + '&pricinglevel_id=' + pricing_level_id, function(itempricinglevel){
$(this).closest('tr').find(".details_unitprice").val(itempricinglevel.min);
})
})
})