次のコードを使用して外部XMLから情報を取得しようとしています。それは私のサーバーに同じファイルをアップロードしたときにのみ機能しました。なぜ外部URLから情報を取得できないのですか?get url:xml外部URLが機能しない理由
<script language="javascript">
// This script uses jQuery to retrieve the news XML file and display the contents
$(document).ready(function(){
$.ajax({
type: "GET",
url: "www.simplyprofound.com/samples/xml_jquery/sample.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('item').each(function(){
var title = $(this).find('title').text();
var source = $(this).find('source').text();
var description = $(this).find('description').text();
$('<div class="news_title"></div>').html(title).appendTo('#news_wrap');
$('<div class="news_source"></div>').html(source).appendTo('#news_wrap');
$('<div class="news_description"></div>').html(description).appendTo('#news_wrap');
});
}
});
});
</script>
私もそれを試しました。とにかくそれを修正するために –