i have a xml file like this
<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>
i parse this xml with jquery so:
var data = {};
$.get('xmlfile.xml', function(xml){
var oXML = $(xml);
oxml.find('user').each(function(i){
data[i].name = $(this).attr('name');
data[i].pic = $(this).attr('pic');
data[i].post = /* i must load a json file with all posts here*/
});
});
the posts are in a extern json file. i have tried to load the json on load xml like this
var data = {};
$.get('xmlfile.xml', function(xml){
var oXML = $(xml);
oxml.find('user').each(function(i){
data[i].name = $(this).attr('name');
data[i].pic = $(this).attr('pic');
data[i].post = $.getJSON($(this).attr('post'), function(data){
retrun data;
});
});
});
But it dosnt work. The value of data[i].post is null. do you have an idea for loading json on load xml ?