Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var files = ['john.xml','doe.xml']
- var newResult, temp;
- function loadMyXMLFiles(){
- // > let's load file by file using jquery's ajax-call:
- $.each(files, function(index,value) {
- $.ajax({
- url: value,
- cache: true,
- success: function(data){
- // > check if temp is empty, append or fill
- (temp) ? temp += (data) : temp = data;
- // > on complete:
- if (index == files.length-1) {
- xmlResult = temp; temp = null;
- }
- }
- });
- });
- }
- loadMyXMLFiles()
- var files = ['john.xml','doe.xml']
- var xmlResult, temp = ""; //Make temp an empty string
- loadMyXMLFiles(){
- $.each(files, function(index,value) {
- $.ajax({
- url: value,
- cache: true,
- async: false, //This is crucial!
- success: function(data){
- temp += data;
- if (index == files.length-1) {
- xmlResult = temp; temp = null;
- }
- }
- });
- });
- }
Add Comment
Please, Sign In to add comment