jQuery Freebase Suggest In Place



I just finished my hack of JQuery In Place Editor to work with Freebase Suggest. I call it “JQuery Suggest In Place”. Its pretty much the same as JQuery Edit In Place, except it is stripped down a bit to only give you an input text field with a bound Freebase Suggest. You can pass along a type (or array of types) and you get back the results by supplying a callback function.

Here’s an example of how it works with a City/Town selector:

Click Me!

And the code to do the above:

<link type="text/css" rel="stylesheet" href="http://freebaselibs.com/static/suggest/1.0.1/suggest.min.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://freebaselibs.com/static/suggest/1.0.1/suggest.min.js"></script>
<script type="text/javascript" src="jquery.suggestinplace.js"></script>
<div class="suggest"></div>
<script type="text/javascript">
$(".suggest").suggestInPlace({callback: function(e, data) {
alert("Name: " + data.name + " Freebase ID: " + data.id);
}});
</script>

Download the source to my jquery.suggestinplace.js hack, under BSD license.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">