Skip to content

Instantly share code, notes, and snippets.

@kepford
Created March 13, 2012 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kepford/2030905 to your computer and use it in GitHub Desktop.
Save kepford/2030905 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
google.load('search', '0', {language : 'en'});
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl('012175768895571244741:5zxvz8g5isy');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.setAutoComplete(true);
customSearchControl.draw('cse', options);
//$(".gsc-input").val("<?php echo $_POST['as_q']; ?>");//insert into search field requested search text
//$('.gsc-input').focus();//give search box focus
customSearchControl.execute('<?php echo $_POST['as_q']; ?>');
//$(".gsc-search-button").click();//call button click event, show results
}, true);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment