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.records.length < 1){ jQuery('#' + 'roblib-search-content-eds').empty().append('No Results'); jQuery('.' + 'pane-roblib-search-eds-roblib-search-eds-results').hide(); } else { jQuery.each(data.records, function(key, val) { //items.push(''); //jQuery.each(val.RecordInfo.BibEntity.Titles, function(key2, val2){ if (typeof val.Items !== 'undefined') { items.push('
'); if (typeof val.Items.Ti !== 'undefined') { jQuery.each(val.Items.Ti, function(key2, val2){ items.push('
'); items.push(''+val2.Data+'
'); }) } jQuery.each(val.RecordInfo.BibRelationships.HasContributorRelationships, function(key3, authors){ items.push('
'+authors.NameFull+'
'); }) if (typeof val.Items.Src !== 'undefined') { jQuery.each(val.Items.Src, function(key4, source){ items.push('
'+source.Data+'
'); }) } if (typeof val.Items.PubIrInfo !== 'undefined') { jQuery.each(val.Items.PubIrInfo, function(key5, pubinfo){ items.push('
'+pubinfo.Data+'
'); }) } if (typeof val.Items.TypPub !== 'undefined') { jQuery.each(val.Items.TypPub, function(key6, typpub){ items.push('
'+typpub.Data+'
'); }) } items.push('
'+val.DbLabel+'
'); items.push('
'); } }); } jQuery('#' + 'roblib-search-content-eds').empty().append(items.join('')); var queries = []; jQuery.each(data.queries, function(key7, query){ queries.push(query.query); }) var query_str = data.queries[0].query; var href_str = 'http://search.ebscohost.com/login.aspx?direct=true&site=ehost-live&scope=site&type=1&custid=uprince&groupid=main&profid=eds&mode=bool&lang=en&bquery='; jQuery('#roblib-search-eds-more').empty().append('See all ' + data.recordCount + ' results'); }); } }