我需要这个项目的帮助,我必须从XML文件而不是HTML本身加载<div>
的内容。而且我不知道如何实现这一点。
<?xml version="1.0" encoding="UTF-8"?>
<all> <!-- this is root -->
<dean>
<p>The Faculty of Computer Science seeks to prepare students for careers as computer specialists of the highest international standards, to enter careers in computer or software design, and for advanced study in computer science.The Faculty of Computer Science has accredited undergraduate degree in computer science, internet computing and software engineering disciplines. The degree was evaluated and accredited by the Egyptian Supreme Council of Higher Education in 1998. Furthermore, Computer Science students can successfully join other universities in Europe and North America, to complete their undergraduate and postgraduate studies. Our programme is designed to provide students with a combination of fundamental knowledge and lifelong learning skills that prepare graduates for a successful career in the computer science, software engineering and internet computing fields. At the same time, our curriculum provides students with the necessary practical skills to enable them to be productive from their first day on the job.</p>
<image>image.jpg</image>
</dean>
<dean>
<p> Graduates of the Faculty of Computer Science at MSA are specialized in several areas within the computing professions. Their expertise and skills are due to unlimited facilities, an up to date curriculum and a group of prominent faculty members.</p>
</dean>
<dean>
<p> Being in touch with international sites, through the Internet and computer usage, is an integrated part of the Computer Science program. In addition, students receive extra attention as they are divided into small groups. Long contact hours and close supervision give students the chance to make the most of their faculty experience. Students are thus, provided with capabilities that prepare them for practical fields in computer science at an international professional level. The Faculty maintains close relationships with computer companies, which provide support to our programme. We aim to be a centre of excellence in computer science for our students, faculty, and local industry.</p>
</dean>
<dean>
<p>Graduates of the Faculty of Computer Science have found satisfying careers in leading computer companies. We welcome all students interested in hard and excellent education in Computer Science, of the highest international standards in a unique pleasant educational environment. We are dedicated in providing a high quality education for all our students.</p>
</dean>
<dean>
<p>Your future awaits you here at MSA,</p>
</dean> <!-- fixed and added end tag in EDIT for XML well-formed-ness -->
<dean>
<p>Prof. Dr. Ali Hamed El Bastawissy</p>
</dean>
<dean>
<p>Dean of the Faculty of Computer Sciences.</p>
</dean>
<dean>
<p>MSA University.</p>
</dean>
</all>
这是我的代码:
$(document).ready(function() {
$.ajax({
type: "GET",
url:"read.xml,
dataType:"xml",
success: xmlParser
});
});
function xmlParser(xml){
$('#load').fadeOut();
$(xml).find("dean").each(function(){
$("#certificate").append('<div class="dean "><img src=" images/'+$(this).find("image").text()+' "width="200" height="225" alt=" '+$(this).find("p").text+' "/> <br/> <div class="dean">'+$ (this).find("p").text()+'<br/>$'+$(this).find("p").text()+'</div></div>');
$(".p").fadeIn(1000);
});
}
#certificate
&#39; s DIV
是我想从XML加载并传递给输出的DIV。