Drupal.behaviors.roblib_search_solr_bestbet_results = { attach: function (context, settings) { if (context == document) { query = drupalSettings.path.currentPath.replace('roblib_search/', ''); solrUrl = settings.solr_site_search_url + query; baseUrl = settings.solr_bestbet_base_url + query; jQuery.getJSON(baseUrl, function (data) { var items = []; total_found = data.resultCount; if (total_found < 1) { jQuery('#' + 'roblib-search-content-solr-site-bestbet').empty().append('No Results'); jQuery('.' + 'pane-roblib-search-solr-site-roblib-search-solr-site-bestbet').hide(); jQuery('.' + 'pane-roblib-search-solr-site-roblib-search-solr-site-' . solrType).hide(); } else { jQuery('#' + 'roblib-search-content-solr-site-bestbet').empty(); var counter = 0; var divs = new Array(); var content = new Array(); jQuery.each(data.results, function (key, val) { id = 'roblib_search_solr_results_bestbet-' + counter; content[counter] = val.teaser; divs[counter++] = id; items.push('
\n\ \n\ ' + val.title + '' + '\n\(' + val.type + ') ' + val.body + '
'); }); jQuery('#' + 'roblib-search-content-solr-site-bestbet').empty().append(items.join('')); } }); } } }