teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

2020/07/06 15:41

投稿

out
out

スコア1

title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,11 @@
1
1
  以下のようにajax通信でjsonをpostするソースを作成しました。
2
2
 
3
+ ```html
4
+
5
+ <button type="button"></button>
6
+
7
+ ```
8
+
3
9
  ```jQuery
4
10
 
5
11
  $("button").click(function() {
@@ -18,8 +24,13 @@
18
24
  success: function(json_data) {
19
25
  location.reload();
20
26
  },
21
- error: function() {
27
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
22
28
  alert("エラー");
29
+
30
+ console.log("XMLHttpRequest : " + XMLHttpRequest.status);
31
+   console.log("textStatus : " + textStatus);
32
+   console.log("errorThrown : " + errorThrown.message);
33
+
23
34
  },
24
35
  complete: function() {
25
36
  button.attr("disabled", false);