How do you transfer the number from datepicker jQuery to variable php?



  • Using this. http://www.malot.fr/bootstrap-datetimepicker/index.php send POST data to variable php?



  • HTML

    <input id='dataTime' size="16" type="text" value="2012-06-15 14:45" readonly class="form_datetime">
    

    JQUERY

     $.ajax({
                url: 'datatime.php',
                data: { dataTime: $("#dataTime").val()},
                method: 'post',
                dataType: 'json'
                success: function (res) {
                    console.log(res.mess)
                }
            })
    

    PHP

    if (isset($_POST['dataTime'])) {
        $dataTime = $_POST['dataTime'];
       return  json_encode(['type'=> 'success', 'mess' => 'Ok']);
    } else {
        return  json_encode(['type'=> 'error', 'mess' => 'Not found']);
    }
    




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2