0

編集: これは、すべてのエラーを見つけることができるページです: http://google.intellectproductions.com/

Google Search API に次の例を使用しています。

<html>
  <head>
    <title>JSON/Atom Custom Search API Example</title>
  </head>
  <body>
    <div id="content"></div>
    <script>
      function hndlr(response) {
      for (var i = 0; i < response.items.length; i++) {
        var item = response.items[i];
        // in production code, item.htmlTitle should have the HTML entities escaped.
        document.getElementById("content").innerHTML += "<br>" + item.htmlTitle;
      }
    }
    </script>
    <script src="https://www.googleapis.com/customsearch/v1?key=YOUR-KEY&cx=017576662512468239146:omuauf_lfve&q=cars&callback=hndlr">
    </script>
  </body>
</html>

しかし、それには欠陥があり、その理由はわかりません。

私のスクリプトタグのURLはこれです:

<script src="https://www.googleapis.com/customsearch/v1?key={{MY KEY}}&cx=012495781369301842149:acs-gv099hu&q=runescape&callback=hndlr">
</script>

しかし、両方の例で、このエラーが発生しています:

Uncaught TypeError: Cannot read property 'length' of undefined 

なぜ彼らはエラーのあるものを投稿するのでしょうか?

4

0 に答える 0