이전에 물어 보았지만 잘못된 것이 무엇인지 알 수 없습니다. XML 파일에서 jQuery를 사용하여 XML 파일을로드하려고합니다. 쇼는 하나의 파일에서 업데이트되고 여러 페이지로 업로드 될 수 있습니다. 내게는 모든 일을 제대로하고있는 것 같지만 내 지식 jquery는 기껏해야 허약하다. 그것의 대부분은 다른 질문에 대한 답변에서 함께 연결됩니다.XML을 가져와 html 테이블에 넣기 위해 Jquery를 사용합니다.
내 HTML
<aside id="shows"class="aside shadow">
<div class="text" id="table">
<div class="more low"> MORE SHOWS </div>
<div class="less"> LESS SHOWS </div>
</div>
</aside>
내 jQuery를
function showData() {
$.ajax({
type: "GET",
url: "shows.xml",
dataType: "xml",
success: function getShows(a) {
$('#table').append('<h2>SHOWS</h2>');
$('#table').append('<table>');
$(a).find('show').each(function(){
var $show = $(this);
var date = $show.find('date').text();
var place = $show.find('place').text();
var location = $show.find('location').text();
var time = $show.find('time').text();
var html = '<tr><td class="bold">' + date + '</td><td class="hide">' + place + '</td><td>' + location + '</td><td class="bold">' + time + '</td></tr></table>';
$('<table>').append(html);
});
}
});
}
및 XML
<shows>
<show>
<date>9/8</date>
<place>Toads Place</place>
<location>New Haven, CT</location>
<time>9PM</time>
</show>
</shows>
이 아무것도하지 않고 이 잘 나에게 완전히 보이는, 그래서 나는 매우 혼란 스러워요. 날 아는 중, 나는 세미 콜론이 없어. > <
감사합니다. 정확한 URL을 넣어
당신이 jQuery를 포함나요? – mowwwalker
jQuery를 포함 시켰습니다 – Jay
그리고 아무 일도 없다는 것은 무엇을 의미합니까? 귀하의 콘솔을 열고 그것이 무엇이든 말을 참조하십시오. ctrl + shift + j with chrome, ctrl + f4 with Firefox, alt + f4 with Ie – mowwwalker