将ajax变量传递给php

I'm using fullCalendar and I want to use the start variable from the "select" callback as a PHP variable.

This is my JavaScript:

select: function(start, end) {
  $('#ModalAdd #start').val(moment(start).format('YYYY-MM-DD '));
  $('#ModalAdd #end').val(moment(end).format('YYYY-MM-DD '));
  $('#ModalAdd').modal('show');

  var start = val(moment(start).format('YYYY-MM-DD ')) ;
  $.ajax({
    type: 'POST',
    data: {start:start},
  });
},

This is my PHP script :

<?php
if( isset($_POST['start']) ){
  $start = $_POST['start'];
  echo json_encode($start);
}
else echo "string";
?>

This is my HTML input:

<input type="text" name="start" class="form-control" id="start" readonly>

but I get "string" as a result.

Echo the $['start'] so you see what it returns first. you can format strings in php to date using the following formats

$time = strtotime('10/16/20019');

$newformat = date('Y-m-d',$time);
echo $newformat;

or in your case $time = strtotime($_POST['start']);

$newformat = date('Y-m-d',$time);
echo $newformat;

Your ajax block is missing the post url.....code should look more like this

$.ajax({  
    type: 'POST',  
    url: 'urltopage.php', 
    data: { start: start },
    success: function(response) {
        console.log('Submitted to php');
    }
});