Google Search API (Single site)
The Google search API is only really useful for searching one site, or a list of related sites. It also has a stingy limit of 100 queries per day, so I guess, Google isn’t really making it easy for people to use it.
Anyway, if those caveats are acceptable, then here’s some code that can be used to query Google in JSON format, once again, this code is designed for Phonegap – or similar trusted environments.
var strUrl = “https://www.googleapis.com/customsearch/v1?”;
strUrl += “q=” +encodeURIComponent(query);
The callback from this function can be rendered simply using mustache thus:
<script id=”resultsTpl” type=”text/template”>
Of course, there’s plenty more data there, but all I needed was the link and title.