我收到此错误“无法读取 null 的属性'值'”,请帮助解决这个问题。我正在尝试获取日期值并传递给 php。谢谢。
<form>
<label for="fromDate">From : </label><input id="from" type="date" id="fromDate" value=""></input>
<label for="toDate">To : </label><input id="to" type="date" id="toDate" value=""></input>
<input type="submit" value="submit"></input>
</form>
<input type="button" onclick="makeAjaxCall();return false;" value="Click to get data"></input>
<script>
function makeAjaxCall() {
var frm = document.getElementById('fromDate').value;//$('#fromDate').datepicker("getDate");
var to = document.getElementById('toDate').value;//$('#toDate').datepicker("getDate");
var postDate ={
"dateFrom" : frm,
"dateTo" : to
};
$.ajax({
type:"POST",
url:'test.php',
data: postData,
success: function(responseData) {
//someCode
}
});
}