0
I have a Datepicker bootstrap as below, and I have a button that must pass the date selected in datepicker to the Servlet that will use this date as parameter for a mysql search. How can I pass this date to Servlet? I have tried with several examples I found on the web, but without success.
Knob:
<img src="IMG/check.png" style="cursor:pointer" onclick="UpdateGrafico();" />
Datepicker:
<!--datepicker1 -->
<div class="container" style="width: 100%;
margin: 0.5em auto;
padding: 1em;
border: 1px solid greenyellow;
border-radius: 0.5em">
<div class="row">
<div class='col-sm-3' style="margin-left:10px;">
<div class="form-group">
<div class='input-group date' id='datetimepicker1' >
<input type='text' class="form-control" id="d"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<img src="IMG/check.png" style="cursor:pointer" onclick="UpdateGrafico();" />
<script type="text/javascript">
$i(function () {
$i('#datetimepicker1').datetimepicker({
format: 'DD/MM/YYYY HH:mm'
});
});
</script>
</div>
</div>
<!--datepicker1 -->
You want to pass via AJAX?
– GeekSilva
Yes via ajax...
– Jovani
You must have already created Servlet, so just send the desired information to the Servlet url. There in Servlet you can use a request.getParameter
– GeekSilva
Yes I already have Servlet, but I can’t pass these date parameters to it.
– Jovani
How’s that function you put there on onclick?
– GeekSilva
I put the function there....
– Jovani