datepicker problem and modal window bootstrap

0

I have the following problem and I have not been able to solve it. I have a bootstrap modal sale. Inside the one an input where the date picker is loaded. It works well, but when selecting a date, it is not loaded in the input. I have tried everything without positive results. here part of the code.

the modal sale is called through ajax:

$('#asigna-modal').on('show.bs.modal', function(e) {
var $modal = $(this),
idp = <?php echo $idped?>;
$.ajax({
  cache: false,
  type: 'POST',
  url: 'ajax/asigna_ped.php',
  data: {"dato" : idp},
  success: function(data) {
      $modal.find('.edit-content').html(data);
  } 
});
})

and inside ajax / assign_ped.php:

<input type="text" class="form-control" id="datePicker" placeholder="dd/mm/aaaa">
<span class="input-group-addon"><i class="icon-calender"></i></span>

and its corresponding function.

$(function () {
$('#datePicker').datepicker({
    format: 'dd/mm/yyyy',
    minDate: '+5d',
    autoclose: 'true',
    language: 'es',
    daysOfWeekDisabled: [0, 6]
})
});

If someone has experienced the same thing or has managed to solve this problem, I would appreciate guidance on how to do it. It is worth mentioning that the libraries are inserted in the main file. as always, thank you very much everyone.

    
asked by maha1982 10.08.2018 в 21:36
source

1 answer

0

Try to try this code:

<div class="container">
    <div class="row">
        <div class='col-sm-6'>
            <div class="form-group">
                <div class='input-group date' id='datetimepicker'>
                    <input type='text' class="form-control" />
                    <span class="input-group-addon">
                        <span class="glyphicon glyphicon-calendar"></span>
                    </span>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            $(function () {
                $('#datetimepicker').datetimepicker();
            });
        </script>
    </div>
</div>
    
answered by 10.08.2018 в 21:40