I have a function that is loading multiple lines of Json string . I was trying to use that to populate a select
element but its not working . I am trying to apply this in a JQM website
Here is the function
function loadgeo2Adminii1(value,child,loading,vd,ponerfocus){
if(parseInt(value,10) > 0){
var url= UrlServer+'index.php?im_core=jsonSearchColonia&im_geo='+value;
$('#im_texto_'+child).val('').selectmenu( "disable" );
$('#im_'+child).val('');
$.get(url,function(data){
data.sort(function(a,b){
if(a.id.toLowerCase()== vd[1].toLowerCase() || b.id.toLowerCase()== vd[1].toLowerCase() )bandera = 1;
var aName = remove_accents(a.label.toLowerCase());
var bName = remove_accents(b.label.toLowerCase());
return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0));}
);
$( '#im_texto_g2').selectmenu( "enable" );
jQuery.each(function(data){
$("#im_texto_g2").find('#im_texto_g2-button').append('<option value="'+data.id+'">'+data.label+'</option>');});
},'json');
}
else{
$('#im_texto_g2'.val('').selectmenu( "disable" );
$('#im_'+child).val('');
}
}
Note: I can see the response in the Firebug
its showing a Json string containing lot of substring . Here is a link to that substring
Also if you look at following part of my script
$( '#im_texto_g2'+child ).find('#im_texto_g2-button').selectmenu( "enable" );
jQuery.each(data,function(i,item){
console.log(item,i);
$("#im_texto_g2").append('<option value="'+item.id+'">'+item.label+'</option>');
});
I am trying to populate the option tag here .
Thanks & Regards