Good afternoon
Value in input change with datepicker ui.
I want use ajax post when value in input will be change.
For this i use script:
<input type="text" name="date" class="datepicker" id="datepicker">
$(".datepicker").datepicker({changeYear: true});
$(".datepicker").on("change",function(){
var date=$(this).val();
$.post("test.php", {
date:date
},
function(data){$('#testdiv').html('');$('#testdiv').html(data);
});
});
But ajax post query is executed with the old date.
Datepicker does not have time change value in input.
Tell me how to do query after datepicker change the date in the field?
Me need:
1) datepicker change the date;
2) query should be send with new date.
You can trigger ajax post on datepicker events:
$("#datepicker").datepicker({
onSelect: function(date, instance) {
$.ajax
({
type: "Post",
url: "www.example.com",
data: "date="+date,
success: function(result)
{
//do something
}
});
}
});
Hope this helps- @Codebrain
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With