我有一个带有Bootstrap 3 Datepicker的表单调用ajax,它会在文本框中打印它的响应(也是一个datetimepicker字段),但是当JQuery函数在输入中打印响应时,对齐是将字符串发送到右侧而不是它的正常属性。
This is how it looks when the response is sent as a .val() to my input field
但是,如果我点击日期时间选择器项目并手动插入它,它会返回到它normal style properties
响应将收到转换为字符串
的日期时间结果HTML
<label class="col-msg-4 control-label form-label">RETURN TIME:</label>
<br />
<div id="data_mov_Out" class="input-append date">
<input data-format="dd/MM/yyyy hh:mm:ss" value="" readonly id="modalMoveRetorno" type="text"></input>
<span style="height: 15px;"> </span>
<div id="modalSaidaIcon" style="display:none;">
<span class="add-on">
<i data-time-icon="fa fa-clock-o" data-date-icon="fa fa-calendar"></i>
</span>
</div>
</div>
<script type="text/javascript">
$(function() {
$('#data_mov_Out').datetimepicker(
{
language: 'pt-BR',
maxDate: moment()
}
);
});
</script>
JQUERY
$.ajax({
url: "includes/pro/lastReturn.php",
data: {
code: itemCode,
place: itemPlace
},
success: function(response) {
$('#modalMoveRetorno').val(response);
$('#modalRetiradaIcon').css('display', 'none');
}
});