Very well I explain, I have a form, I use the date picker range for the dates, and it works, I make a console.log and it gives me the start date and the end date, everything is fine up to there, the point now is how do I send that variable to my search query in ASP.
$(function () {
$('input[name="daterange"]').daterangepicker({
opens: 'left'
}, function (start, end, label) {
//console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
//Estas son las 2 variables que quiero enviar por separado
var finicio = start.format('YYYY-MM-DD');
var ffinal = end.format('YYYY-MM-DD');
});
});
This is the query as you can see I need the start date and the end date to be able to filter:
where b.fecha_ef>='2018-09-01' and b.fecha_ef<='2018-09-30'
But the point is how do I put my variables, something like that?
where b.fecha_ef>=finicio and b.fecha_ef<=ffinal
I would really appreciate it, it's been a while :/
The date selection input:
<input type="text" name="daterange" class="form-control" value="11/09/2018 - 11/30/2018" />
One solution could be to create two hidden fields and put the values returned by the datapicker in them.
In this way, then if you could retrieve the values from vb and put them in the query.
We would create the hidden:
We would retrieve the value of the datepicker in these variables:
$('input[name="daterange"]').daterangepicker({ opens: 'left' }, function (start, end, label) { //console.log("A new date selection was made: " + start .format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
}); });
and later we could retrieve the value of the hidden in the query:
Hope this can help you.
Cheers