我想通过 ajax 发送信息。为此,我有一个输入字段,我需要在其中输入文本和一些日期。要输入日期,我使用 datepicker。我面临的问题是只传递了日期。例如,如果我写12/12/2013 12:12 this is a text
然后才12/12/2013 12:12
通过。请问我知道如何解决这个问题吗?
<script>
$('#tabAll').click(function(){
$('#tabAll').addClass('active');
$('.tab-pane').each(function(i,t){
$('#myTabs li').removeClass('active');
$(this).addClass('active');
});
});
$('body').on('click', '.btn', function(){
if(this.id=='openAlert')
{$('#number').val('');}else{$('#number').val(this.id);}
});
</script>
<script >
$(document).ready(function(){
$('#openAlert').click(function(){
var number = $('#number').val(); // If its a text input could use .text()
var msg = $('#body').val(); //If its a text input could use .text()
alert(number);
$.ajax(
{
type: "POST",
url: "messageSending.jsp", //Your full URL goes here
data: { toNumber: number, body: msg},
success: function(data, textStatus, jqXHR){
alert(data);
},
error: function(jqXHR){
alert(jqXHR.responseStatus);
}
});
});
});
</script>
<script type="text/javascript">
$('#datetimepicker').datetimepicker({
format: 'dd/MM/yyyy hh:mm:ss',
language: 'eng'
});
</script>
html
<div class="span3"> <div id="datetimepicker" class="input-append date">
<input type="text" name="body" maxlength="160" placeholder="Enter message to send" id="body" data-trigger="hover">
</input><span class="add-on">
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
</div>