XModPro

jQuery check for empty feed

Mandy Hodges Mandy Hodges asked Jun 23, 2014
Active Jun 26 · Viewed 2764 times
<p>Hi,</p><p>I am using a feed to load related content (a list of states for a country).</p><p>This works fine for countries that have states. However I want to display "[[countryName]] has no states" in the loadfeed target div when the feed is empty.&nbsp;</p><p>I found that you can't use a NoItemsTemplate in the feed, so I tried using jQuery, but the feed had not loaded yet when the script was called, therefore my 'if #divStates is empty' line triggered whether or not the feed was actually empty.</p><p>Is there another way to do this?</p><p>Thanks,</p><p>Mandy</p>

2 Answers

Loading answers...