Julien Becker
Julien Becker

Reputation: 31

Freebase suggest key

Freebase suggest looks great, so I wanted to test it. I first just copied and pasted their simple example in a new page and tested it locally. I got a list of results as soon as I started to type something in the input box, but the fly out pane stayed empty. Here the code of that page :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/freebase/suggest/4_0/suggest.min.css" />
<script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/freebase/suggest/4_0/suggest.min.js"></script>
<script type="text/javascript">
  $(function() {
  $("#myinput").suggest({
                 filter:'(all type:/film/film)'});
  });
</script>
</head>
<body>
<input type="text" id="myinput"/>
</body>
</html>

If I search for example for Star Wars there is no image and no text that is loaded into the fly out pane. I thought it was because I had no API key, so I got one on google's API console and added "http://mysite.com:8888/mysite.com/" as a referer (I'm testing this in a MAMP folder). As explained on the wiki page I've added my key to my code.

$("#myinput").suggest({
                       key:'my key',
                       filter:'(all type:/film/film)'});
});

Now when type in something in the input box I just get "Searching..." as a result. I suppose I did something wrong on the google API console, I'm not sure what referees I should enter.

Upvotes: 1

Views: 356

Answers (1)

Julien Becker
Julien Becker

Reputation: 31

Ok I figured it out, my referers on Google's API Console where wrong. The right format for my local address was simply :

mysite.com:8888

Upvotes: 1

Related Questions