Drupal.behaviors.roblib_search_eds = { attach: function(context, settings) { $url = settings.roblib_search_eds.search_url; jQuery.getJSON($url, function(data) { var items = []; if(data.length < 1){ jQuery('#' + 'roblib-search-content-eds').empty().append('No Results'); } else { jQuery.each(data.records, function(key, val) { items.push('
'); jQuery.each(val.RecordInfo.BibEntity.Titles, function(key2, val2){ items.push('
'); items.push(val2.TitleFull+'
'); }) items.push('
'); }); } jQuery('#' + 'roblib-search-content-eds').empty().append(items.join('')); }); } }