Send a date in the database from the calendar datepicker UI using ajax
Hi,
Please, tell me how can I send a date in the database from the calendar datepicker UI using AJAX?
I have this HTML:
- <div id="datepicker"></div>
- <form method="post" id="myform" name="myform">
- <input id="input" name="input" type="text">
- </form>
And this JAVASCRIPT:
- jQuery(document).ready(function() {
- $( "#datepicker").datepicker({
- dateFormat: 'dd/mm/yy',
- altField: '#input',
- onSelect: function(dateText, inst) {
- $.ajax({
- type: 'POST',
- url: "process.php",
- dataType: "json",
- data: dateText,
- success: function(data) {
- console.log("Done");
- }
- }); }
- });
- });
But the date wasn't inserted into the database.
I don't understand why?
P.S. When I try do this without AJAX everything OK.