Custom search engine for Google not working

1.6k views Asked by At

I am trying to integrate custom search engine of google but to no avail. Every time it returns 'No Result' for every data passed. Code:

<script>
  (function() {
    var cx = '009439376788807650262:rd6prt0twra';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//cse.google.com/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<div>
                            <gcse:search resultsUrl="http://amniltech.com.np/investment/" newWindow="true" queryParameterName="search">
                        </gcse:search>
                        </div>

Can anyone help me here? What am I doing wrong? I am using fuelphp.

1

There are 1 answers

0
Pranav Shah On
  <script>
  (function() {
  var cx = 'Your_Cx_iD';
  var gcse = document.createElement('script');
  gcse.type = 'text/javascript';
 gcse.async = true;
  gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
    '//cse.google.com/cse.js?cx=' + cx;
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search resultsUrl="http://www.amniltech.com.np/investment/"        newWindow="true" queryParameterName="search">

This will work.