質問編集履歴

1

htmlに取得したデータを表示しました。

2017/09/07 02:36

投稿

subchan
subchan

スコア24

test CHANGED
File without changes
test CHANGED
@@ -38,6 +38,30 @@
38
38
 
39
39
  <a href="#" id="post">post</a>
40
40
 
41
+ <table border="1">
42
+
43
+ <tbody>
44
+
45
+ <tr>
46
+
47
+ <th>code</th>
48
+
49
+ <td id="code"> </td>
50
+
51
+ </tr>
52
+
53
+ <tr>
54
+
55
+ <th>message</th>
56
+
57
+ <td id="message"> </td>
58
+
59
+ </tr>
60
+
61
+ </tbody>
62
+
63
+ </table>
64
+
41
65
  <script src="//code.jquery.com/jquery-1.11.3.js"></script>
42
66
 
43
67
  <script>
@@ -78,6 +102,26 @@
78
102
 
79
103
  alert("success:" + data[0]);
80
104
 
105
+
106
+
107
+ // 取れてた
108
+
109
+ console.log('ログ', data);
110
+
111
+ console.log('ログ', data.error);
112
+
113
+ console.log('ログ', data.error.code);
114
+
115
+ console.log('ログ', data.error.message);
116
+
117
+ // レスポンスデータを画面に表示してみた
118
+
119
+ $("#code").text(data.error.code);
120
+
121
+ $("#message").text(data.error.message);
122
+
123
+
124
+
81
125
  }).fail(function(data) {
82
126
 
83
127
  alert("error");