-
Notifications
You must be signed in to change notification settings - Fork 0
/
expedia_test.html
53 lines (43 loc) · 1.36 KB
/
expedia_test.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
<html>
<head>
<script src="http://yui.yahooapis.com/3.10.0/build/yui/yui-min.js"></script>
<script>
YUI().use('jsonp', 'jsonp-url', function (Y) {
function getExpediaUrl(city, ccode) {
var url =
"http://api.ean.com/ean-services/rs/hotel/v3/list?minorRev=22"+
"&cid=55505"+
"&apiKey=<INSERT_API_KEY_HERE>"+
"&locale=en_US"+
"¤cyCode=GBP"+
"&city="+city+
"&countryCode="+ccode+
"&supplierCacheTolerance=MED_ENHANCED"+
"&arrivalDate=04/27/2013"+
"&departureDate=04/31/2013"+
"&room1=2"+
"&numberOfResults=10"+
"&callback={callback}";
return url
}
function getHotelInfo(resp) {
console.log(resp);
for(property in resp) {
console.log(property)
}
console.log(resp["HotelListResponse"])
console.log(resp["HotelListResponse"]["HotelList"])
console.log(resp["HotelListResponse"]["HotelList"]["HotelSummary"])
console.log(resp["HotelListResponse"]["HotelList"]["HotelSummary"][0])
console.log(resp["HotelListResponse"]["HotelList"]["HotelSummary"][0]["address1"])
var firstHotelAddr = resp["HotelListResponse"]["HotelList"]["HotelSummary"][0]["address1"];
document.getElementById("result").innerHTML = "first hotel address: "+firstHotelAddr
}
Y.jsonp(getExpediaUrl(city, ccode), getHotelInfo);
});
</script>
</head>
<body>
<div id="result"></div>
</body>
</html>