1
我在我的js中有两个来自xml文件的变量,我如何将它们作为li元素追加到我的#list ul中?我的意思是,每个li元素都必须包含来自脚本的标题和url。从xml追加两个变量到html
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
type: "GET",
url: "#",
cache: false,
dataType: "xml",
success: function (xml) {
$(xml).find('HotelExportElionDto').each(function (hotelList) {
$(this).find("Title").each(function() {
var title = $(this).text();
});
$(this).find("SeoUrl").each(function() {
var url = $(this).text();
});
});
}
});
});
</script>
<ul id="list"></ul>
正是我需要的,谢谢你,你真棒! –
@VladimirHumeniuk很乐意为您效劳。继续访问。 – Jai