What I have currently is once the page loads the wordStats goes out and counts the words and then it takes them and we use the most popular to pull information from a JSON file.
The problem is that if it does not find the most popular word then it just gives off an error and I am not sure how to provided it with a default value. I have pasted my code below along with a sample of my JSON. Thanks. <script language="javascript" type="text/javascript"> $(function() { var count = 3; $.extend($.wordStats.stopWords, {'retrieved': true, '2007': true}); $.wordStats.computeTopWords(count); for(var i = 0, j = $.wordStats.topWords.length; i < j && i <= count; i++) { var $type = $.wordStats.topWords[0].substring(1); } $.getJSON('test.json',function(data) { $.each(data[$type], function(key,state) { alert(state); }); }); $.wordStats.clear(); }); </script> //// JSON { 'corvair' : { 'corvair' : 'Corvairs are fun!'}, 'default' : {'default' : 'Default Text'} }