Chrome開發工具告訴我第3行有錯誤,但我不確定它是什麼。無可否認,我是使用jQuery進行編碼的新手,所以我跟隨的教程可能會出錯。在代碼中找不到語法錯誤
$.ajax({
url: 'https://www.carcraft.atsbusinessandgames.com/xmls/carcraft_1-7-10Test.xml',
type: "Get",
dataType: 'xml',
success: function (result) {
}
$(result).find('Module').each(function() {
//$("#ModsList").append($(this).text());
var authors = $(this).find('authors').text();
var version = $(this).find('version').text();
var date = $(this).find('date').text();
var episode = $(this).find('episode').text();
$("#ModsList").append("<tr>" + "<td>" + $authors + "</td>" + "<td>" + $version + "</td>" + "<td>" + $date + "</td>" + "<td>" + $episode + "</td>" + "</tr>");
});
error: function() {
alert("Notify the site owner that the xml file has a syntax error and is therefore unreadable.");
}
});
這是我想通過上面的代碼修改表:
<table id="ModsList">
<tr style="font-weight: bold;">
<td>Mod Name</td>
<td>Author(s)</td>
<td>Version</td>
<td>Date added/updated</td>
<td>Episode Added</td>
</tr>
</table>
哪一行是3?當你只有'authors'時爲什麼要使用'$ authors'? – guradio
請發佈您正在收到的錯誤 –
您的成功回調被錯誤地關閉。 – hmd