Reputation: 12589
I'm using the zRSSFeed jQuery plugin in a web part to read in two feeds and place them in separate DIVs. Here's my markup:
<script type="text/javascript">
$(document).ready(function ()
{
try
{
$('#Buildings_feed').rssfeed('http://feeds.feedburner.com/BreakingNewsFromBuilding', {
limit: 5, snippet: false, content: false, target: '_blank'
});
alert('Buildings code has been executed');
}
catch (ex)
{
alert('Something Buildings went wrong: ' + ex);
}
try
{
$('#NCE_feed').rssfeed('http://www.nce.co.uk/XmlServers/navsectionRSS.aspx?navsectioncode=681', {
limit: 5, snippet: false, content: false, target: '_blank'
});
alert('NCE code HAS been executed!');
}
catch (ex)
{
alert('Something NCE went wrong: ' + ex);
}
});
</script>
<div class="mainInfoBoxContentHolder">
<div id="NCE_feed" />
<div id="Buildings_feed" />
</div>
The problem I'm having is that only the top DIV gets filled. Both calls are succeeding, as I'm not falling into either catch
block. I've done some stepping through in the zrssfeed js, it seems that the first call succeeds and the HTML gets built, but it never gets assigned to the DIVs innerHTML (using the jQuery .html() method) correctly, because it then gets overwritten by the HTML from the second call. It's like the target DIV gets picked up the first time through the code and that reference is never changed to the second DIV (is the best explanation I can come up with). Is there a jQuery guru out there who can suggest what might need to be changed to fix this?
Upvotes: 0
Views: 682
Reputation: 26
I know you asked this a while ago but hopefully this will still help you.
You need to close your div tags.
<div class="mainInfoBoxContentHolder">
<div id="NCE_feed"></div>
<div id="Buildings_feed"></div>
</div>
The Problem is that DIVs are containers and must have an opening and closing tag. Your current code opens the div but closes with the first closing tag it finds, in this case, that's the tag that is supposed to close your "mainInfoBoxContentHolder" div.
Upvotes: 1