get url:xml why external url does not work
- by Kazim Cubbali
I am trying to grab information from an external xml with the following code. It only worked when I uploaded same file to my servers. Why cant I grab information from an external 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>