JSON EAN PHOTOS V2
V2 PUSH
by Andrew Pougher
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<div id="hotelphotos"></div><div id="d"></div>
CSS
#d{font-size:19px}
#hotelphotos img {max-height:130px;width:auto;margin-left:3px;}
JavaScript
var hoteluniq = '254746';// 418219 413233 254746 (good)
photosUrl = "http://api.ean.com/ean-services/rs/hotel/v3/roomImages?cid=55505&minorRev=20&apiKey=sahaahrmg27wfg2acwcs3p2k&customerSessionId=0ABAA849-049C-B791-3D32-E9A87BB92A70&hotelId=" + hoteluniq ;
$.ajax({
url: photosUrl,
dataType: "jsonp",
beforeSend: function () {
$("#d").html('loading...');
},
success: function (data) {
if(data.HotelRoomImageResponse.EanWsError) {
$("#hotelphotos").append("Sorry, there are no photos at this time");
return false
}else{
var base = (data.HotelRoomImageResponse.RoomImages.RoomImage);
var Pics = [];
$(base).each(function (eventID,eventData){
// IMS
$(this).each(function(index,val) {
Pics.push("<img src='"+val.url+"' class='img-polaroid'>");
});
});
$("#hotelphotos").append(Pics);
}// end else
},
complete: function () {
$("#d").fadeOut('fast');
...