Hello,
I realize this isn't specifically a Guardian API question - it is more of a JQuery question. I have tested the stand-alone URL and it works fine - it returns the items in my browser when I navigate directly to the URL. My page below will display 10 list items with nothing but my labels. The iteration of ten items means it is seeing the ten stories in the query, but for some reason my syntax is wrong and I am not getting the content at all.
Thanks for looking and any advice you're willing to give.
Best,
-SH
<!DOCTYPE html>
<html>
<head>
<script>
$.ajax({
dataType: 'xml',
success: function(usnews){
$(usnews).find('result').each(function() {
var strTitle = $(this).find('web-title').text();
var vurl = $(this).find('web-url').text();
var vpubdate = $(this).find('web-publication-date').text();
$('.newsitem ul').append(
$('<li />', {
text: 'Article: ' + strTitle
})
);
$('.newsitem ul').append(
$('<li />', {
text: 'URL: ' + vurl
})
);
$('.newsitem ul').append(
$('<li />', {
text: 'Date: ' + vpubdate
})
);
});
},
error: function() {
$(".newsitem").html('<p>Error: ' + error + '</p>');
}
});
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>Guardian</td>
</tr>
<tr>
<td><div class="newsitem"><ul><!-- News Content--></ul></div></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>