I want to use Datepicker(from Jquery) on django in this way:
Through the "views.py" i'm sending a list of dates from mysql DB. I want to display a message when a date that a user had chosen is equal to one of the dates i have in the DB.
How can i make this happen? (with Django, Jquery and AJAX)
My code so far:
{% block head %}
<link href="{{STATIC_URL}}css/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="{{STATIC_URL}}js/jquery1.min.js"></script>
<script src="{{STATIC_URL}}js/jquery-ui.min.js"></script>
<script>
$(function() {
$( "#datepicker" ).datepicker({
showOtherMonths: true,
selectOtherMonths: true,
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true,
});
date = $( "#datepicker" ).datepicker('getDate');
});
</script>
{% endblock %}
{% block body_block %}
<br/><br/><br/><br/><br/><br/><br/>
<form id="form" name="form" action="/home/" method="get">
<label>Choose Date</label>
<br/>
<input style="color:black" id="datepicker"/>
<br/><br/>
</form>
{% for date in dates %}
...............
Thanks.