{"id":1625,"date":"2014-10-17T10:00:41","date_gmt":"2014-10-17T01:00:41","guid":{"rendered":"http:\/\/www.sria.co.jp\/blog\/?p=1625"},"modified":"2014-09-18T17:58:13","modified_gmt":"2014-09-18T08:58:13","slug":"lets-use-ajax-part-1-try-it-with-ajax-and-json","status":"publish","type":"post","link":"https:\/\/www.sria.co.jp\/blog\/2014\/10\/lets-use-ajax-part-1-try-it-with-ajax-and-json\/","title":{"rendered":"\u4f7f\u3063\u3066\u307f\u3088\u3046Ajax\uff01\u524d\u7de8\u301cAjax\u3068JSON\u3092\u5408\u308f\u305b\u3066\u4f7f\u3063\u3066\u307f\u308b\u301c"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff01<br \/>\nJavaScript\u304c\u5927\u5acc\u3044\u3059\u304e\u3066\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306b\u5bfe\u3057\u3066\u6bba\u610f\u304c\u82bd\u751f\u3048\u308bsato\u3067\u3059\u3002<\/p>\n<p>&nbsp;<br \/>\n\u3055\u3066\u4eca\u65e5\u306f\u3001\u30c7\u30b6\u30a4\u30ca\u30fc\u3068\u5b66\u3076\u30b7\u30ea\u30fc\u30ba\u306e\u3072\u3068\u3064\u3068\u3057\u3066<br \/>\n\u73fe\u4ee3\u306eWEB\u30b5\u30a4\u30c8\u306b\u306f\u6b20\u304b\u305b\u306a\u3044\u300cAjax\u300d\u306e\u304a\u52c9\u5f37\u3092\u3057\u305f\u306e\u3067\u3001\u305d\u306e\u5185\u5bb9\u3092\u5fa9\u7fd2\u3082\u517c\u306d\u3066\u30e1\u30e2\u3063\u3066\u3044\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p>&nbsp;<\/p>\n<h3>Ajax\u3068\u306f\u306a\u3093\u305e\u3084<\/h3>\n<p>Ajax\u3068\u306f\u2026\u300cAsynchronous Javascript+XML\u300d\u306e\u7565\u79f0\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<blockquote><p>\nJavaScript \u306e\u7d44\u307f\u8fbc\u307f\u30af\u30e9\u30b9\u3067\u3042\u308b XMLHttpRequest \u3092\u5229\u7528\u3057\u305f<strong>\u975e\u540c\u671f\u901a\u4fe1<\/strong>\u3092\u5229\u7528\u3057\u3066\u3001\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u65e2\u5b58\u306e\u67a0\u7d44\u307f\u306b\u3068\u3089\u308f\u308c\u306a\u3044\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306e\u6280\u8853\u3002\u5b9f\u969b\u306b\u306f Ajax \u3068\u3044\u3046\u6280\u8853\u304c\u5b58\u5728\u3057\u3066\u3044\u308b\u308f\u3051\u3067\u306f\u306a\u304f\u3001DHTML (JavaScript + CSS) \u3068 XMLHttpRequest \u306b\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306e\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u3092\u52a0\u3048\u305f\u3042\u308f\u305b\u6280\u306e\u3053\u3068\u3092 Ajax \u3068\u547c\u3076\u3088\u3046\u306b\u306a\u3063\u305f\u3002<br \/>\nAjax \u3092\u7528\u3044\u3066\u69cb\u7bc9\u3055\u308c\u305f\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u306e\u4ee3\u8868\u4f8b\u3068\u3057\u3066 Google Suggest \u3084 Google Maps \u304c\u3042\u308b\u3002<\/p>\n<p>&nbsp;<br \/>\n<a target=\"_blank\" href=\"http:\/\/d.hatena.ne.jp\/keyword\/Ajax\">http:\/\/d.hatena.ne.jp\/keyword\/Ajax<\/a>\n<\/p><\/blockquote>\n<p>&nbsp;<br \/>\n\u30d5\u30e0\u30d5\u30e0\u306a\u308b\u307b\u3069\u5927\u4f53\u5206\u304b\u3063\u305f\u3002<br \/>\n\u3082\u3046\u5c11\u3057\u308f\u304b\u308a\u3084\u3059\u304f\u3001Google Maps\u306e\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<br \/>\n<a href=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2014\/09\/blog_ajax_1.png\"><img loading=\"lazy\" class=\"aligncenter wp-image-1630\" src=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2014\/09\/blog_ajax_1.png\" alt=\"\u4eca\u307e\u3067\u306f\u3053\u3046\" width=\"400\" height=\"127\" \/><\/a><\/p>\n<p>&nbsp;<br \/>\n\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u3001\u30de\u30c3\u30d7\u3092\u6b21\u306e\u5730\u70b9\u306b\u79fb\u52d5\u3055\u305b\u305f\u3044\u3068\u304d\u2026<br \/>\n\u898b\u305f\u3044\u5730\u70b9\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u305d\u306e\u5ea6\u306b\u30b5\u30fc\u30d0\u30fc\u306b\u898b\u305f\u3044\u5730\u70b9\u306e\u60c5\u5831\u304c\u884c\u304d\u3001\u30b5\u30fc\u30d0\u30fc\u3067\u753b\u50cf\u3092\u751f\u6210\u3057\u3066\u304b\u3089\u30ea\u30ed\u30fc\u30c9\u3092\u304b\u3051\u3066\u8868\u793a\u3055\u305b\u308b\u3001\u3068\u3044\u3046\u3082\u306e\u3067\u3057\u305f\u3002<br \/>\n\u53e4\u3044\u30ab\u30fc\u30ca\u30d3\u3082\u3053\u3093\u306a\u611f\u3058\u3067\u3057\u305f\u3088\u306d\u3002\u9023\u6253\u3057\u3061\u3083\u3063\u3066\u30a2\u30a1\u30c3\uff01\uff01\u3063\u3066\u306a\u308b\u2026\u3002<\/p>\n<p>&nbsp;<br \/>\n\u30c7\u30fc\u30bf\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3057\u3066\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u304c\u6765\u3066\u3001\u3084\u3063\u3068\u8868\u793a\u3059\u308b\u3002\u3053\u308c\u3092\u3001<strong>\u540c\u671f\u901a\u4fe1<\/strong>\u3068\u3044\u3044\u307e\u3059\u3002<br \/>\n\u30e1\u30fc\u30eb\u30d5\u30a9\u30fc\u30e0\u306a\u3069\u3082\u3001\u5185\u5bb9\u3092\u66f8\u3044\u3066submit\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u9001\u4fe1\u3059\u308b\u3068\u300c\u9001\u4fe1\u3057\u307e\u3057\u305f\u300d\u3068\u3044\u3046\u30da\u30fc\u30b8\u306b\u79fb\u52d5\u3057\u307e\u3057\u305f\u3088\u306d\u3002<br \/>\n\u540c\u671f\u901a\u4fe1\u3067\u306f\u30ea\u30af\u30a8\u30b9\u30c8\u3057\u3066\u30ec\u30b9\u30dd\u30f3\u30b9\u304c\u8fd4\u3063\u3066\u304f\u308b\u307e\u3067\u306e\u9593\u3001\u4ed6\u306e\u51e6\u7406\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>&nbsp;<br \/>\n<a href=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2014\/09\/blog_ajax_2.png\"><img loading=\"lazy\" class=\"aligncenter wp-image-1630\" src=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2014\/09\/blog_ajax_2.png\" alt=\"\u4eca\u307e\u3067\u306f\u3053\u3046\" width=\"400\" height=\"127\" \/><\/a><\/p>\n<p>&nbsp;<br \/>\n\u6bce\u56de\u6bce\u56de\u30ea\u30ed\u30fc\u30c9\u3055\u308c\u308b\u306e\u3067\u91cd\u3044\u3057\u898b\u96e3\u3044\u2026\u3002<\/p>\n<p>&nbsp;<br \/>\n<a href=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2014\/09\/blog_ajax_3.png\"><img loading=\"lazy\" class=\"aligncenter wp-image-1630\" src=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2014\/09\/blog_ajax_3.png\" alt=\"\u4eca\u306f\u3053\u3046\" width=\"400\" height=\"127\" \/><\/a><\/p>\n<p>&nbsp;<br \/>\n\u3067\u3082\u73fe\u5728\u306eGoogle Maps\u306f\u9055\u3044\u307e\u3059\u3088\u306d\uff01<br \/>\nAjax\u3092\u4f7f\u7528\u3059\u308c\u3070\u8868\u793a\u3057\u305f\u3044\u90e8\u5206\u3060\u3051\u3092\u6301\u3063\u3066\u304d\u3066\u304f\u308c\u308b\u306e\u3067\u3001\u30ea\u30ed\u30fc\u30c9\u305b\u305a\u306b\u3044\u304f\u3089\u3067\u3082\u300c\u305a\u3089\u3057\u3066\u300d\u52d5\u304b\u305b\u308b\uff01<br \/>\n\u3053\u308c\u304c<strong>\u975e\u540c\u671f\u901a\u4fe1<\/strong>\u3067\u3059\u3002<br \/>\n\u975e\u540c\u671f\u901a\u4fe1\u306a\u3089\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u5f85\u305f\u306a\u304f\u3066\u3082\u305d\u306e\u5f85\u3063\u3066\u3044\u308b\u9593\u306b\u4ed6\u306e\u51e6\u7406\u304c\u3067\u304d\u3066\u3057\u307e\u3046\u3002\u30ed\u30fc\u30c9\u306e\u5fc5\u8981\u304c\u306a\u3044\u3093\u3067\u3059\uff01<br \/>\n\u3060\u304b\u3089\u3001\u4e0b\u306e\u30de\u30c3\u30d7\u306e\u3088\u3046\u306b\u30b0\u30ea\u30b0\u30ea\u3068\u52d5\u304b\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3059\u3002<\/p>\n<p>&nbsp;<br \/>\n<iframe src=\"https:\/\/www.google.com\/maps\/embed?pb=!1m18!1m12!1m3!1d3132.8457145057223!2d140.8834759351959!3d38.2598842060309!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x5f8a281888b6b24f%3A0x9ba4361995f181cf!2z5LuZ5Y-w6aeF!5e0!3m2!1sja!2sjp!4v1411013075256\" width=\"740\" height=\"300\" frameborder=\"0\" style=\"border:0\"><\/iframe><br \/>\n\u30b0\u30ea\u30b0\u30ea\u2026\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>Ajax\u3092\u4f7f\u3063\u3066\u4f55\u304b\u8868\u793a\u3057\u3066\u307f\u308b<\/h3>\n<p>\u3067\u306fAjax\u3068\u306f\u306a\u3093\u306a\u306e\u304b\u3082\u3093\u3084\u308a\u3068\u308f\u304b\u3063\u305f\u3068\u3053\u308d\u3067\u4eca\u56de\u3084\u308b\u3053\u3068\u3067\u3059\u304c\u3001\u5b9f\u969b\u306bGoogle Maps\u3092\u4f5c\u3063\u3066\u307f\u3088\u3046\uff01\u3068\u3044\u3046\u308f\u3051\u306b\u306f\u3044\u304b\u306a\u3044\u306e\u3067\u3001\u3068\u308a\u3042\u3048\u305a\u8868\u793a\u3057\u3066\u307f\u308b\u3060\u3051\u306e\u672c\u5f53\u306b\u7c21\u5358\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305aAjax\u306f\u3069\u3046\u3084\u3063\u3066\u66f8\u304f\u306e\u304b\uff1f\u3067\u3059\u306d\u3002<\/p>\n<p>&nbsp;<br \/>\nAjax\u306f\u3001\u307f\u3093\u306a\u5927\u597d\u304d<strong>JavaScript<\/strong>\u3067\u66f8\u304d\u307e\u3059(\u68d2)\u3002<\/p>\n<p>&nbsp;<br \/>\n\u4eca\u56de\u306f\u300cJSON\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30c7\u30fc\u30bf\u3092\u6301\u3063\u3066\u304d\u3066\u753b\u9762\u306b\u8868\u793a\u3059\u308b\u300d\u3068\u3044\u3046\u7c21\u5358\u306a\u3082\u306e\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"lang:js decode:true \">\n$.ajax({\n  type: \"get\",\n  url: \"test.json\",\n  data: {name: 'chara'},\n  dataType: \"json\"\n  success: function(data, dataType){}\n});\n<\/pre>\n<p>&nbsp;<br \/>\nAjax\u306e\u66f8\u304d\u65b9\u306e\u57fa\u672c\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>&nbsp;<br \/>\n<strong>type<\/strong>\u306b\u306fHTTP\u901a\u4fe1\u306e\u7a2e\u985e\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\nAjax\u306f&#8221;get&#8221;\u304b&#8221;post&#8221;\u3067\u3059\u3002\u6301\u3063\u3066\u304f\u308b\u304b\u9001\u308b\u304b\u3001\u3067\u3059\u306d\u3002<br \/>\n\u4eca\u56de\u306f&#8221;get&#8221;\u3092\u4f7f\u3063\u305f\u4f8b\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<br \/>\n<strong>url<\/strong>\u306b\u306f\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3059\u308b\u5148\u306eURL\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\ntest.json&#8221;\u3001test.php&#8221;\u3001test.js&#8221;\u306a\u3069\u306a\u3069\u2026\u3002<\/p>\n<p>&nbsp;<br \/>\n<strong>data<\/strong>\u306b\u306f\u3001\u30d5\u30a9\u30fc\u30e0\u30c7\u30fc\u30bf\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<br \/>\n<strong>dataType<\/strong>\u306b\u306f\u3001\u30b5\u30fc\u30d0\u304b\u3089\u8fd4\u3055\u308c\u308b\u30c7\u30fc\u30bf\u306e\u578b\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306fJSON\u304b\u3089\u30c7\u30fc\u30bf\u3092\u6301\u3063\u3066\u304d\u307e\u3059\u306e\u3067\u3001json\u3068\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u305d\u306e\u4ed6\u3001xml\u3001html\u3001json\u3001jsonp\u306a\u3069\u306a\u3069\u2026\u3002<\/p>\n<p>&nbsp;<br \/>\n<strong>success<\/strong>\u306b\u306f\u3001\u901a\u4fe1\u6210\u529f\u6642\u306b\u547c\u3070\u308c\u308b\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>\u30b3\u30fc\u30c9<\/h3>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306aJSON\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:js decode:true \">\n{\n  \"charas\":[\n    {\n      \"id\": 1,\n      \"chara\":\"Shimada Mayu\",\n      \"cv\":\"Yoshioka Mayu\"\n    },\n    {\n      \"id\": 2,\n      \"chara\":\"Hayashida Airi\",\n      \"cv\":\"Eino Airi\"\n    },\n    {\n      \"id\": 3,\n      \"chara\":\"Katayama Minami\",\n      \"cv\":\"Tanaka Minami\"\n    },\n    {\n      \"id\": 4,\n      \"chara\":\"Nanase Yoshino\",\n      \"cv\":\"Aoyama Yoshino\"\n    },\n    {\n      \"id\": 5,\n      \"chara\":\"Hisami Nanami\",\n      \"cv\":\"Yamashita Nanami\"\n    },\n    {\n      \"id\": 6,\n      \"chara\":\"Kikuma Kaya\",\n      \"cv\":\"Okuno Kaya\"\n    },\n    {\n      \"id\": 7,\n      \"chara\":\"Okamoto Miyu\",\n      \"cv\":\"Takagi Miyu\"\n    }\n  ]\n}\n<\/pre>\n<p>\u307f\u3093\u306a\u3060\u3044\u3059\u304d\u300c<a target=\"_blank\" href=\"http:\/\/wakeupgirls.jp\/\">Wake Up, Girls\uff01<\/a>\u300d\u306e\u7686\u3055\u3093\u3067\u3059\u3002<br \/>\n\uff08\u4ed9\u53f0\u3092\u821e\u53f0\u3068\u3057\u305f\u30a2\u30cb\u30e1\u3067\u3059\u3002\u6fc0\u63a8\u3057\u4e2d\u3067\u3059\uff01\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u3068\u58f0\u512a\u306e\u540d\u524d\u304c\u540c\u3058\u306a\u3093\u3067\u3059\u3088\uff01\uff01\uff09<\/p>\n<p>&nbsp;<br \/>\n\u4f8b\u3048\u3070\u753b\u50cf\u3092\u305a\u3089\u301c\u301c\u3063\u3068\u6ca2\u5c71\u8868\u793a\u3059\u308b\u30b5\u30a4\u30c8\u306a\u3069\u306f\u305d\u306e\u7ba1\u7406\u304c\u5927\u5909\u3002\u305d\u3046\u3044\u3046\u3068\u304d\u306b\u3053\u3093\u306a\u611f\u3058\u3067JSON\u306b\u307e\u3068\u3081\u3066\u304a\u3051\u3070\u4fee\u6b63\u3082\u8ffd\u52a0\u3082\u524a\u9664\u3082\u697d\u3067\u3044\u3044\u3067\u3059\u3088\u306d\u3002<br \/>\nJSON\u306e\u66f8\u304d\u65b9\u306f\u3068\u3063\u3066\u3082\u7c21\u5358\u3067\u3059\u3002\u5927\u4f53\u4e0a\u306e\u3088\u3046\u306a\u611f\u3058\u306a\u306e\u3067\u3059\u304c\u3001\u3082\u3063\u3068\u8a73\u3057\u304f\u77e5\u308a\u305f\u3044\u65b9\u306f\u3053\u3061\u3089\u3092\u3054\u53c2\u8003\u306b\u2026\u3002<\/p>\n<p>&nbsp;<br \/>\n<a href=\"http:\/\/hakuhin.jp\/js\/json.html\" target=\"_blank\"><img loading=\"lazy\" class=\"alignleft\" align=\"left\" border=\"0\" src=\"http:\/\/capture.heartrails.com\/75x75\/shadow?http:\/\/hakuhin.jp\/js\/json.html\" alt=\"\" width=\"75\" height=\"75\" \/><\/a><a style=\"color:#0070C5;\" href=\"http:\/\/hakuhin.jp\/js\/json.html\" target=\"_blank\">JavaScript\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8b1b\u5ea7\u3010JSON \u306b\u3064\u3044\u3066\u3011<\/a><a href=\"http:\/\/b.hatena.ne.jp\/entry\/http:\/\/hakuhin.jp\/js\/json.html\" target=\"_blank\"><img src=\"http:\/\/b.hatena.ne.jp\/entry\/image\/http:\/\/hakuhin.jp\/js\/json.html\" alt=\"\" \/><\/a><br \/><strong>http:\/\/hakuhin.jp\/js\/json.html<\/strong><br style=\"clear:both;\" \/><\/p>\n<p>&nbsp;<br \/>\nhtml\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u7c21\u5358\u306b\u3001\u9069\u5f53\u306b\u2026\u3002<\/p>\n<pre class=\"lang:html decode:true \">\n<div class=\"nameData\">\n  <p>\u304c\u3093\u3070\u3063\u30da\uff01Wake Up, Girls\uff01<\/p>\n<\/div>\n<\/pre>\n<p>\u305d\u3057\u3066JavaScript\u306f\u3053\u306e\u3088\u3046\u306b\u3002<br \/>\n\u4eca\u56de\u306f\u300cget\u300d\u3067\u3001JSON\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u6301\u3063\u3066\u304d\u307e\u3059\u3002\u3000<\/p>\n<pre class=\"lang:js decode:true \">\n$.ajax({\n\turl: 'json\/data.json',\n\tdataType: 'json',\n\tdata: {name: 'chara'},\n\tsuccess: function(data){\n\t\tvar dataArray = data.charas;\n\t\t\n\t\t$.each(dataArray, function(i){\n\t\t\t$(\".nameData\").append(\"<p>id: \" + dataArray[i].id + \"\u3000Character: \" + dataArray[i].chara + \"\u3000\u3000(CV: \" + dataArray[i].cv + \")<\/p>\");\n\t\t});\n\t}\n});\n<\/pre>\n<p><strong>url: &#8216;json\/data.json&#8217;<\/strong><br \/>\n\u30c7\u30fc\u30bf\u306f\u300cjson\u300d\u3068\u3044\u3046\u540d\u524d\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u5165\u308c\u305f\u306e\u3067\u3001\u300cjson\/data.json\u300d\u3068\u66f8\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>&nbsp;<br \/>\n<strong>dataType: &#8216;json&#8217;<\/strong><br \/>\n\u4eca\u56de\u306fJSON\u30c7\u30fc\u30bf\u3092\u4f7f\u3044\u307e\u3059\u306e\u3067\u3001dataType\u306fjson\u3002<\/p>\n<p>&nbsp;<br \/>\n<strong>success<\/strong><br \/>\n.nameData\u306b\u3001id\u3001\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u540d\u3001\u58f0\u512a\u306e\u540d\u524d\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<br \/>\n\u5b9f\u884c\u3059\u308b\u3068\u3053\u3093\u306a\u611f\u3058\u3067\u8868\u793a\u3055\u308c\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2014\/09\/blog_ajax_6.png\"><img loading=\"lazy\" class=\"aligncenter wp-image-1630\" src=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2014\/09\/blog_ajax_6.png\" alt=\"\u7d50\u679c\" width=\"444\" height=\"222\" \/><\/a><\/p>\n<p>&nbsp;<br \/>\n\u56e0\u307f\u306b\u3001JSON\u30d5\u30a1\u30a4\u30eb\u3092\u8868\u793a\u3059\u308b\u5834\u5408\u306f\u4e0a\u306e\u3088\u3046\u306a\u300c$.ajax({})\u300d\u3092\u4f7f\u308f\u305a\u306b<br \/>\n\u300c$.getJSON( url, data, callback )\u300d\u3092\u4f7f\u3046\u3053\u3068\u3082\u51fa\u6765\u307e\u3059\uff01<\/p>\n<pre class=\"lang:js decode:true \">\n$.getJSON(\"json\/data.json\", {name: \"chara\"}, function(data){\n\tvar dataArray = data.charas;\n\t\n\t$.each(dataArray, function(i){\n\t\t$(\".nameData\").append(\"<p>id: \" + dataArray[i].id + \"\u3000Character: \" + dataArray[i].chara + \"\u3000\u3000(CV: \" + dataArray[i].cv + \")<\/p>\");\n\t});\n});\n<\/pre>\n<p>\u5185\u5bb9\u306f\u5168\u304f\u540c\u3058\u3067\u3059\u3002\u3053\u3061\u3089\u306e\u307b\u3046\u304c\u77ed\u304f\u307e\u3068\u307e\u3063\u3066\u3044\u3066\u826f\u3044\u3067\u3059\u306d\u3002<br \/>\n\u5f8c\u7de8\u3067\u306f\u3053\u306e\u3088\u3046\u306a\u5f62\u3067\u66f8\u3044\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>\u6b21\u56de\u4e88\u544a<\/h3>\n<p>\u4eca\u56de\u306f\u3053\u3053\u307e\u3067\u3067\u3059\u3002<\/p>\n<p>&nbsp;<br \/>\n\u3068\u308a\u3042\u3048\u305a\u6587\u5b57\u3092\u8868\u793a\u3057\u3066\u307f\u307e\u3057\u305f\u3002JSON\u304b\u3089\u6301\u3063\u3066\u304f\u308b\u3084\u308a\u65b9\u306f\u306a\u3093\u3068\u306a\u304f\u308f\u304b\u3063\u305f\u3067\u3057\u3087\u3046\u304b\uff1f<br \/>\n\u4eca\u56de\u306f&#8221;get&#8221;\u3092\u4f7f\u3063\u305f\u7c21\u5358\u306a\u8868\u793a\u306e\u4ed5\u65b9\u3092\u66f8\u304d\u307e\u3057\u305f\u304c\u3001\u6b21\u56de\u306f&#8221;post&#8221;\u3092\u4f7f\u3044\u3001php\u3067\u51e6\u7406\u3057\u305f\u30c7\u30fc\u30bf\u3092JSON\u5f62\u5f0f\u306b\u3057\u3066html\u4e0a\u306b\u8868\u793a\u3059\u308b\u65b9\u6cd5\u3092\u66f8\u3044\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\uff01<\/p>\n<p>&nbsp;<br \/>\n\u6b21\u56de\u300c\u30dd\u30b9\u30c8\u300d<br \/>\n\u30b5\u30c8\u30a6\u304c\u98f2\u3080\u30a6\u30c9\u306e\u30b3\u30fc\u30d2\u30fc\u306f\u82e6\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>\u53c2\u8003\u306b\u3057\u305f\u30b5\u30a4\u30c8<\/h3>\n<p>\u30fb<a target=\"_blank\" href=\"http:\/\/www.atmarkit.co.jp\/ait\/articles\/0708\/23\/news134.html\" title=\"\u3044\u307e\u3055\u3089\u805e\u3051\u306a\u3044\u3001\u201cAjax\u201d\u3068\u306f\u4f55\u306a\u306e\u304b\uff1f\">\u3044\u307e\u3055\u3089\u805e\u3051\u306a\u3044\u3001\u201cAjax\u201d\u3068\u306f\u4f55\u306a\u306e\u304b\uff1f<\/a><br \/>\n\u30fb<a target=\"_blank\" href=\"http:\/\/www.tohoho-web.com\/js\/jquery\/ajax.htm\" title=\"\u3068\u307b\u307b\u306ejQuery\u5165\u9580\">\u3068\u307b\u307b\u306ejQuery\u5165\u9580<\/a><\/p>\n<p>&nbsp;<br \/>\n\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\uff01<br \/>\n\u3082\u3063\u3068\u8a73\u3057\u304f\u77e5\u308a\u305f\u3044\u65b9\u306f\u4e0a\u8a18\u30b5\u30a4\u30c8\u3082\u30c1\u30a7\u30c3\u30af\u30c1\u30a7\u30c3\u30af\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff01 JavaScript\u304c\u5927\u5acc\u3044\u3059\u304e\u3066\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306b\u5bfe\u3057\u3066\u6bba\u610f\u304c\u82bd\u751f\u3048\u308bsato\u3067\u3059\u3002 &nbsp; \u3055\u3066\u4eca\u65e5\u306f\u3001\u30c7\u30b6\u30a4\u30ca\u30fc\u3068\u5b66\u3076\u30b7\u30ea\u30fc\u30ba\u306e\u3072\u3068\u3064\u3068\u3057\u3066 \u73fe\u4ee3\u306eWEB\u30b5\u30a4\u30c8\u306b\u306f\u6b20\u304b\u305b\u306a\u3044\u300cAjax\u300d\u306e\u304a\u52c9\u5f37\u3092\u3057&#8230;<\/p>\n","protected":false},"author":5,"featured_media":234,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14,8],"tags":[91,49,38],"_links":{"self":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/1625"}],"collection":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=1625"}],"version-history":[{"count":88,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/1625\/revisions"}],"predecessor-version":[{"id":1750,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/1625\/revisions\/1750"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/media\/234"}],"wp:attachment":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=1625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=1625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=1625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}