Reputation: 27
Once I add the date and time the url should like this become
http://metrobikes.in/api/cities/1/models?start_time=14%3A00&end_time=16%3A00&end_date=2017-10-27&start_date=2017-10-27
I.e. it should load the bikes available at that time
$('#btn-bik-sel').on('click', function() {
alert("asdada");
alert($('#datetimepicker2').val());
});
function available() {
var date = $('#datetimepicker2').val();
$.ajax({
url: 'http://metrobikes.in/api/cities/1/models?',
method: "GET",
data: {
'start_time': start_time,
'end_time': end_time,
'end_date': end_date,
'start_date': start_date
},
}).done(function(data) {
for (var i = 0; i < data.result.data.length; i++) {
console.log(data);
};
});
};
<div class="col-xs-6">
<input type="text" class="form-control date-time" id="datetimepicker2" placeholder="Start date">
<input type="text" class="form-control date-time" id="datetimepicker1" placeholder="Start time" style="margin-top: 10px">
</div>
<div class="col-xs-6">
<input type="text" class="form-control date-time" id="datetimepicker21" placeholder="End date">
<input type="text" class="form-control date-time" id="datetimepicker111" placeholder="End time" style="margin-top: 10px">
</div>
<div class="col-xs-12 text-center" style="margin-top: 10px;">
<button class="btn btn-primary" id="btn-bik-sel">Continue</button>
</div>
Upvotes: 2
Views: 99
Reputation: 983
You are not setting values to start_time
, end_time
, start_date
and end_date
. They don't magically set the values without you writing some code to do it. You can get those values using
$('#your-id').val();
Upvotes: 0
Reputation: 159
try to change your data
section to this:
...
data: {
'start_time': $('#datetimepicker1').val(),
'end_time': $('#datetimepicker111').val(),
'end_date': $('#datetimepicker21').val(),
'start_date': $('#datetimepicker2').val()
},
Upvotes: 2