39 lines
970 B
PHP
39 lines
970 B
PHP
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<title>JSON Content</title>
|
||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||
|
<script>
|
||
|
$(document).ready(function() {
|
||
|
setInterval(function() {
|
||
|
$.ajax({
|
||
|
url: "showDate.php",
|
||
|
dataType: "json",
|
||
|
success: function(data) {
|
||
|
$("#json-content").text(JSON.stringify(data));
|
||
|
}
|
||
|
});
|
||
|
}, 1);
|
||
|
});
|
||
|
$(document).ready(function() {
|
||
|
$("#myInput").on("input", function() {
|
||
|
$.ajax({
|
||
|
url: "write.php",
|
||
|
method: "POST",
|
||
|
data: {
|
||
|
content: $(this).val()
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<div id="json-content"></div>
|
||
|
<input type="text" id="myInput">
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|