发布datepicker值

时间:2015-03-27 22:38:34

标签: javascript php jquery html datepicker

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

我有两个页面(使用脚本找到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>

输入       

            <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"> 

在fetch_pages.php

$startDate = isset($_POST['startDate']) ? $_POST['startDate']: null; 
$endDate = isset($_POST['endDate']) ? $_POST['endDate']: null;

现在正在发生的事情是,当datepicker工作时,当我选择输入时,datepicker出现并显示日期但我不认为帖子被执行,因为我回显了startDate和endDate没有显示< / p>

0 个答案:

没有答案