get url:xml why external url does not work
Posted
by Kazim Cubbali
on Stack Overflow
See other posts from Stack Overflow
or by Kazim Cubbali
Published on 2009-08-06T17:19:29Z
Indexed on
2010/05/01
22:07 UTC
Read the original article
Hit count: 238
jQuery
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>
© Stack Overflow or respective owner