I am working on a j2ee application. In my application I have a drop-down list(or Select element). I want to populate this drop-down list with JSON data as a Ajax response.
try to change the jquery method variable, it might be causing the problem (i.e., you are using the data
variable coming from the ajax callback PLUS are then trying to assign it to the item
object in the jquery method - changed to obj
):
$.ajax({
type: "GET",
url:"/demo_trial_application/json_source",
dataType: "json",
success: function (data) {
$.each(data.aaData,function(i,obj)
{
alert(obj.value+":"+obj.text);
var div_data="";
alert(div_data);
$(div_data).appendTo('#ch_user1');
});
}
});
});