[英]How to access two different XML files with jQuery Ajax calls
我有兩個功能
function ShowCrossWord(var randN)
{
randomnumber = randN;
$(document).ready(function() {
$.get("crosswords.xml",{},function(xml){
$('crossword',xml).each(function(i) { });
});
});
}
和
function ShowLegend(var randN)
{
randomnumber = randN;
$(document).ready(function() {
$.get("legends.xml",{},function(xml){
$('legend',xml).each(function(i) {});
});
});
}
我在同一個javascript文件中使用這些:
var randomNumber=Math.floor(Math.random()*233);
ShowCrossWord(randomNumber);
ShowLegend(randomNumber);
他們似乎都不起作用。 解決辦法是什么。
您期望發生什么,實際發生了什么?
所以我可以看到:
我建議您仔細檢查以上幾點,然后使用FireBug進一步縮小問題范圍。
我想您從服務器發送的XML的模仿類型是錯誤的。 做到這一點非常挑剔,否則XML不會在客戶端上解析。
您可以嘗試注冊成功和錯誤的回調函數,並記錄錯誤消息和XMLHTTPRequest對象。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.