-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax_search.html
53 lines (43 loc) · 1.84 KB
/
ajax_search.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>My Google AJAX Search API Application</title>
<link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet"/>
<script src="http://www.google.com/uds/api?file=uds.js&v=0.1&key=ABQIAAAA8YgzjtSJZhw4YnyN8zypJxRDjjN5V4nWNRKqqPVEKlMJGmfzHxRUs5-AILt1I8LJPTx3Ley-b_MktA" type="text/javascript"></script>
<script language="Javascript" type="text/javascript">
//<![CDATA[
var searchControl, localSearch;
function OnLoad() {
// Create a search control
searchControl = new GSearchControl();
var searchOptions = new GsearcherOptions();
searchOptions.setExpandMode(GSearchControl.EXPAND_MODE_CLOSED);
// Add in a full set of searchers
localSearch = new GlocalSearch();
searchControl.addSearcher(localSearch, searchOptions);
// Set the Local Search center point
localSearch.setCenterPoint("TF3 UK");
localSearch.setAddressLookupMode(GlocalSearch.ADDRESS_LOOKUP_ENABLED);
searchControl.setSearchCompleteCallback(this, OnSearchComplete);
// Tell the searcher to draw itself and tell it where to attach
var element = document.getElementById("searchcontrol");
searchControl.draw(element);
element.innerHTML = '<strong>Hello Google Search</strong>';
}
function OnSearchComplete()
{
var results = new Array();
for(var i=0; i < localSearch.results.length; i++)
{
alert("lat=" + localSearch.results[i].lat + ", lng = " + localSearch.results[i].lng);
}
}
//]]>
</script>
</head>
<body onload="OnLoad()">
<div id="searchcontrol" />
<div id="searchResults" />
</body>
</html>