Blackberry OS 5+ 用の HTML5 アプリケーションを開発しています。
私はjQueryを使用してXMLファイルをダウンロードし、この関数を使用して表示しています:
$(document).ready(function()
{
$.ajax({
type: "GET",
url: "http://xxx.com/yyy/mTop",
dataType: "xml",
success: function(xml) {
$(xml).find('item').each(function(){
var tipo = $(this).find('tipo').text();
var porcentaje = $(this).find('porcentaje').text();
$('<div class="items"></div>').html('<p>' + tipo + ' - ' + porcentaje + '</p>').appendTo('#page-wrap');
});
}
});
});
しかし、私はこのエラーが発生しています:
XMLHttpRequest cannot load http://xxx.com/yyy/mTop. Origin file:// is not allowed by Access-Control-Allow-Origin.
リモート XML ファイルを解析するにはどうすればよいですか?
おそらく、取得した XML を jQuery で使用できるように DOM オブジェクトに変換する必要があります。