[jQuery] how to access dynamic data?
hello groupies
1 ) how do i access ajax generated data? i have a select box
populating via another select. like this:
$("select#parent").change(function(){
var path='json.provider.php';
var options = '';
$.getJSON(path,
{
con:'getdata',
val:$(this).val()
},
function(jsondata){
$.each(jsondata.data,function(i){
options += '<option
value="'+
jsondata.data[i].id+
'">'+
jsondata.data[i].name+
'</option>';
});
$('#child').html(options);
});
});
this code populates my #child select element which is a simple html
select with no option as defult and getting populated on #parent
change function. now how do i get access to the chosen value of
#child? or any ajax generated data.
i tried adding another change function to #child but didn't work :
$(#child).change(function(){
console.log($(this).val());
}
this returns : undefined.
2 ) is there anyway to get access to generated ajax content via php or
do i have to send data with jquery ajax?