これが私のhtml/ajaxコードです
<head>
<script language="javascript" type="text/javascript">
<!--
//Browser Support Code
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var date = document.getElementById('Date').value;
var queryString = "?date=" + date;
ajaxRequest.open("GET", "php.php" + queryString, true);
ajaxRequest.send(null);
}
//-->
</script>
<!--showDate AJAX script -->
<!-- //Calender Script -->
<link rel="stylesheet" type="text/css" media="all" href="scripts/jsDatePick_ltr.min.css"/>
<!--JavaScript-->
<script type="text/javascript" src="scripts/jsDatePick.min.1.3.js"></script>
<!--For javascript Calendar-->
<script type="text/javascript">
window.onload = function(){
new JsDatePick({useMode:2, target:"Date", cellColorScheme:"orange", dateFormat:"%d-%m-%Y",});};
</script>
</head>
<body>
<form action="">
Date : <input type="text" size="20" id="Date" name="Date"/>
<input type="submit" name="submit" value="Submit" onClick="ajaxFunction()"/>
</form>
<div id="ajaxDiv">Time slots will be listed here...</div>
</body>
ここに私のPHPコードがあります
<?php
$d = $_GET['date'];
$timestamp = strtotime($_GET['date']);
$date = date("Y-m-d",$timestamp);
echo "Time is $date";
?>
カレンダーから日付を選択すると、日付が下に表示されます。残念ながら、うまくいきません。誰かが私の問題を解決するのを手伝ってください。エラーを修正するために何度も試みましたが、まだ修正できません。ほとんど気絶。