Reputation: 1848
My Google custom search is stuck forever loading. The JS error I get in the Chrome console is:
Uncaught TypeError: Object [object Object] has no method 'enableSearchBoxOnly'
My code:
<div class="search">
<div id='cse-search-form' style='width: 100%;'>Loading</div>
</div>
<script src='//www.google.com/jsapi' type='text/javascript'></script>
<script type='text/javascript'>
google.load('search', '1', {language: 'es', style: google.loader.themes.DEFAULT});
google.setOnLoadCallback(function() {
var customSearchOptions = {};
var customSearchControl = new google.search.CustomSearchControl('003806993800906102968:1a2oqwxzgqk', customSearchOptions);
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.enableSearchBoxOnly('https://www.globalsign.es/buscar', 'q');
customSearchControl.draw('cse-search-form', options);
}, true);
</script>
Thanks in advance for any help!
Upvotes: 0
Views: 861
Reputation: 120486
The API Reference indicates that enableSearchBoxOnly
is mis-capitalized. Try
options.enableSearchboxOnly('https://www.globalsign.es/buscar', 'q');
instead of starting "box" with a capital b.
options.enableSearchBoxOnly('https://www.globalsign.es/buscar', 'q');
^
Upvotes: 2