Created
May 16, 2021 15:20
-
-
Save ichii731/a4666659c3a1536246f5b5ab63b5faab to your computer and use it in GitHub Desktop.
index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<!-- モバイル最適化 --> | |
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | |
<!-- CDN読み込み --> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | |
</head> | |
<body> | |
テキストを入力<br><textarea id="text"></textarea><br><button id="send">カウントする</button> | |
<div id="ret"></div> | |
<script> | |
$(function () { | |
$("#send").on("click", function (event) { | |
let id = $("#text").val(); | |
$.ajax({ | |
type: "POST", | |
url: "count.php", | |
data: { "id": id }, | |
dataType: "text" | |
}).done(function (data) { | |
// 通信成功時の処理 | |
$("#ret").html(data); | |
}).fail(function (XMLHttpRequest, status, error) { | |
// 津神失敗時の処理 | |
alert(error); | |
}); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment