1
현재 jquery의 ajax 함수를 사용하여 xml 파일을로드하고 있습니다. 파일의 내용이 현재 IE에로드되거나 파싱되지 않습니다. 내 xml에서 올바른 응답 헤더를 지정해야하는 여러 장소를 읽었지 만, PHP 나 다른 언어를 통해 생성 된 XML과 관련된 대부분의 예제가 있기 때문에 어디서해야할지 모르겠습니다. 내 'dataType'내 아약스 호출에서 현재 'html'입니다. 이것이 내가 바꿀 필요가 있는지, 아니면 XML 파일에서 뭔가를 바꿀 필요가 있는지, 아니면 완전히 다른 것인지는 잘 모르겠습니다. 주어진 도움을 주셔서 감사합니다!
이미 언급 한 바와 같이$.ajax({
url: 'images/gallery-images/gallery-images.xml',
dataType: "html",
success: function(parseXML){
$(parseXML).find('section').each(function(){
var $section = $(this),
photos = $section.find('photo'),
videos = $section.find('video'),
photoContainer = $('<div></div>', { id : $section.attr('id'), 'class' : 'gallery-section' });
var videoContainer = $('<div></div>', { id : 'video-inner' });
photos.each(function(){
var photo = $(this),
imageurl = photo.attr('imageurl'),
title = photo.find('title').text(),
description = photo.find('description').html(),
kind = photo.find('description').attr('type');
icon = photo.find('icon').attr('source');
iconClass = photo.find('icon').attr('class');
var photoWrapper = $('<div class="photo"></div>'),
imageElem = $('<img />', { 'src' : imageurl, 'class' : 'gallery-photo' }),
photoInfo = $('<div></div>', { 'class' : 'photo-info ' + kind }),
iconInsert = $('<img />', { 'src' : icon, 'class' : iconClass }),
header = $('<h1></h1>', { text: title }),
photoDescription = $('<div></div>', { html: description });
photoInfo.append(iconInsert).append(header).append(photoDescription);
photoWrapper.append(imageElem).append(photoInfo);
photoContainer.append(photoWrapper);
});
videos.each(function(){
var video = $(this).html();
photoContainer.append(videoContainer);
videoContainer.append(video);
});
$('#photo-viewer-inner').append(photoContainer);
});
}
});
나는 내 XML의 유효성을 검사하는 중입니다. 잠시 후 다시 확인하겠습니다. – jcbfshr