Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google Custom Search v2无法在Ajax上加载_Ajax_Search_Google Custom Search - Fatal编程技术网

Google Custom Search v2无法在Ajax上加载

Google Custom Search v2无法在Ajax上加载,ajax,search,google-custom-search,Ajax,Search,Google Custom Search,我正在将我的网站改为ajax+pushstate技术,我遇到了一些问题 我已经设法修复了twitter、facebook和google+按钮,但我找不到重新加载google自定义搜索框的功能 这是我现在正在使用的代码: <script> (function() { var cx = 'google_search_id'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.a

我正在将我的网站改为ajax+pushstate技术,我遇到了一些问题

我已经设法修复了twitter、facebook和google+按钮,但我找不到重新加载google自定义搜索框的功能

这是我现在正在使用的代码:

<script>
(function() {
var cx = 'google_search_id';
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = false;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
    '//www.google.com.br/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();
</script>

(功能(){
var cx='google_search_id';
var gcse=document.createElement('script');gcse.type='text/javascript';gcse.async=false;
gcse.src=(document.location.protocol=='https:'?'https:':'http:')+
“//www.google.com.br/cse/cse.js?cx=”+cx;
var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(gcse,s);
})();