I have created a script while making an ajax call i have a div in which there is a table within that table tr there is a list of data I want to get that newly added tr value but when I try to do that it gives me an error of undefined as when I see that row is just added is it possible to get new added row value by class name within same call made ? Please refer my code below I am not good in explaining my question but your comments are appreciated I can answer them.
$.ajax({
type: "POST",
data: {
symbol: symbol,
val1: val1,
val2: val2,
val3: val3,
val4: val4,
val5: val5,
val6: val6,
val7: val7,
line_val: line_val
},
dataType: "text",
url: "getCompanyData.php",
success: function(data) {
$('.content_panel').append(data);
$('.load_analyzer').hide();
}
});
if ($('.radiobox').hasClass('activeradio')) {
var active_line = $('.activeradio .line_check').val();
var new_added = $('.line2').attr('data-line2');
}
console.log('New Added Value : ' + new_added); // This is showing as undefined as this row is just being added with above call how do I get this value
ifstatement inside thesuccesscallback. As your code stands you're attempting to access an element that doesn't yet exist in the DOM.