I'm trying to get data from a json file but it fails to return anything. I'm very new at this. Here is a fiddle.
$.ajax({
type: 'GET',
url: 'http://sunrise.bluechipholidays.co.uk/webservices/property/availability/apikey/demo/propertycode/ha01/date/2012-05-01/nights/5/echo/html',
dataType: 'jsonp',
success: function(json) {
var result = '<h3>' + json.bookable + '</h3>' +
'<p>Languages: ' + json.price + '</p>' +
'<p>Followers: ' + json.available + '</p>';
$('#test').append(result);
}
});
Many thanks!
Try
<input class="datepicker" />
<div id="test"></div>
then
$('.datepicker').datepicker({
onSelect: function (date) {
$.ajax({
type: 'GET',
url: 'http://sunrise.bluechipholidays.co.uk/webservices/property/availability/apikey/demo/propertycode/ha01/date/' + $.datepicker.formatDate("yy-mm-dd", $(this).datepicker('getDate')) + '/nights/5/echo/html',
success: function (json) {
$.each(json.data, function (_, json) {
var result = ' <h3> ' + json.bookable + ' </h3>' +
'<p>Languages: ' + json.price + '</p> ' +
' <p> Followers: ' + json.available + ' </p>';
$('#test').html(result);
});
}
});
}
});
Demo: Fiddle