Javascript 后日期选择器值

Javascript 后日期选择器值,javascript,php,jquery,html,datepicker,Javascript,Php,Jquery,Html,Datepicker,我有两个日期选择器(一个用于开始日期,一个用于结束日期): 我有两个页面(datepicker及其脚本所在的页面,以及帖子所在的php页面) 以下是主页中发生的情况: <script> $(function() { $(".dpicks").datepicker(); $('.dpicks').on('change', function() { $val = $(this).val(); docum

我有两个日期选择器(一个用于开始日期,一个用于结束日期):

我有两个页面(datepicker及其脚本所在的页面,以及帖子所在的php页面)

以下是主页中发生的情况:

<script>
$(function() {

     $(".dpicks").datepicker();

    $('.dpicks').on('change', function() {
        $val = $(this).val();
                        document.getElementById("results").innerHTML = "<div class='loading-indication'><img src='ajax-loader.gif' /> &nbsp; Please wait... Loading New Courses...</div>";

    var datastring = $('#testform').serialize(); // this will create key/value pairs to send to the phph page like `duration5=5` with a `&` sepparating each key/value pair 
$('#display-datastring').html(datastring); // this line is just so you can see the variable being created 
$.ajax({ 
url: 'fetch_pages.php', 
type: 'post', 
data: datastring, 
success: function(res){ 

$('#results').html(res); 
} 
}); 
    });
      $(".dpicke").datepicker();

    $('.dpicke').on('change', function() {
        $val = $(this).val();
                        document.getElementById("results").innerHTML = "<div class='loading-indication'><img src='ajax-loader.gif' /> &nbsp; Please wait... Loading New Courses...</div>";

    var datastring = $('#testform').serialize(); // this will create key/value pairs to send to the phph page like `duration5=5` with a `&` sepparating each key/value pair 
$('#display-datastring').html(datastring); // this line is just so you can see the variable being created 
$.ajax({ 
url: 'fetch_pages.php', 
type: 'post', 
data: datastring, 
success: function(res){ 

$('#results').html(res); 
} 
}); 
    });
  });

</script>

现在成功的情况是,当日期选择器工作时,当我选择输入时,日期选择器出现并显示一个日期,但我认为post不会执行,因为我回显startDate和endDate,没有显示任何内容,而
dateEnd
endDate
不同。使用与元素名称相匹配的正确值,您会更接近。如果可能的话,请提供一个提琴,我怀疑当日期选择器初始化输入中的某个内容时,它会变得无效,如果输入具有无效字段,则可能导致字段的提交为空抱歉,你们是对的,我将其命名为不正确,现在我的小问题依赖于这里的日期格式,现在它输出为2015年3月18日,但我需要输出为yyyy-mm-dd
            <input type="text"  placeholder="Start" style="width: 40%;" name="dateStart"  class="dpicks" > 
                            <label id="Paylbl0">To</label>

             <input type="text"  style="width: 40%;" placeholder="End" name="dateEnd" class="dpicke"> 
$startDate = isset($_POST['startDate']) ? $_POST['startDate']: null; 
$endDate = isset($_POST['endDate']) ? $_POST['endDate']: null;