jQuery - Load json in a XML load Event

marvolo

New Member
i have a xml file like this\[code\]<users> <user> <name>LOREM</name> <pic>LOREM</pic> <post>www.URL.com/info.json</post> </user> <user> <name>LOREM</name> <pic>LOREM</pic> <post>www.URL.com/info.json</post> </user></users>\[/code\]i parse this xml with jquery so:\[code\]var data = http://stackoverflow.com/questions/14463920/{};$.get('xmlfile.xml', function(xml){ var oXML = $(xml); oxml.find('user').each(function(i){ data.name = $(this).attr('name'); data.pic = $(this).attr('pic'); data.post = /* i must load a json file with all posts here*/ });});\[/code\]the posts are in a extern json file. i have tried to load the json on load xml like this \[code\]var data = http://stackoverflow.com/questions/14463920/{};$.get('xmlfile.xml', function(xml){ var oXML = $(xml); oxml.find('user').each(function(i){ data.name = $(this).attr('name'); data.pic = $(this).attr('pic'); data.post = $.getJSON($(this).attr('post'), function(data){ retrun data; }); });});\[/code\]But it dosnt work. The value of \[code\]data.post\[/code\] is null. do you have an idea for loading json on load xml ?
 
Back
Top