{"id":1899,"date":"2021-10-23T00:45:07","date_gmt":"2021-10-22T15:45:07","guid":{"rendered":"https:\/\/www.itchefblog.com\/?p=1899"},"modified":"2021-10-23T00:47:18","modified_gmt":"2021-10-22T15:47:18","slug":"ajax%eb%a1%9c-%eb%b0%9b%ec%95%84%ec%98%a8-csv-%eb%8d%b0%ec%9d%b4%ed%84%b0-%ed%8c%8c%ec%9d%bc%eb%a1%9c-%ec%a0%80%ec%9e%a5%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/www.itchefblog.com\/?p=1899","title":{"rendered":"ajax\ub85c \ubc1b\uc544\uc628 CSV \ub370\uc774\ud130 \ud30c\uc77c\ub85c \uc800\uc7a5\ud558\uae30"},"content":{"rendered":"\n<p>\ubc14\ub85c \uc774\uc804 \ud3ec\uc2a4\ud305\uc5d0\uc11c\ub294 Spring Boot\uc5d0\uc11c CSV \ucd9c\ub825\ud558\ub294 \ubc29\ubc95\uc744 \ud3ec\uc2a4\ud305 \ud588\ub294\ub370, \uc774\ubc88\uc5d0\ub294 \ubc1b\uc544\uc628 response\ub370\uc774\ud130\ub97c JS \ub97c \uc774\uc6a9\ud558\uc5ec \ud30c\uc77c\ub85c \uc800\uc7a5\ud558\ub294 \ubc29\ubc95\uc744 \uac04\ub2e8\ud788, \ucf54\ub4dc\ub9cc, \uc791\uc131\ud574\ubcf8\ub2e4.<\/p>\n\n\n\n<p>ajax call\uc740 jQuery\ub97c \uc774\uc6a9\ud588\uc9c0\ub9cc \ud30c\uc77c \uc800\uc7a5\ubd80\ubd84\uc740 javascript \ub97c \uc774\uc6a9\ud588\uae30\uc5d0 axios\ub97c \uc774\uc6a9\ud558\ub4e0 \ubb58 \uc774\uc6a9\ud558\ub4e0 \uac04\uc5d0 CSV \ub370\uc774\ud130\ub97c \ud30c\uc77c\ub85c \uc800\uc7a5\uc2dc\uc5d0 \ud65c\uc6a9 \uac00\ub2a5\ud55c \ucf54\ub4dc\uc774\ub2e4.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$.ajax({\n        url: &quot;API ENDPOINT URL + PATH&quot;,\n        type : &quot;GET&quot;,\n        headers: { AUTHENTICATION CREDENTIALS (\ub9cc\uc57d \uc778\uc99d\uc774 \ud544\uc694\ud558\ub2e4\uba74) },\n        dataType: &quot;text&quot;,\n        success: function(data) {\n            const filename = datetime + &quot;_\ud14c\uc2a4\ud2b8_\ub370\uc774\ud130.csv&quot;\n            if(data != undefined){\n                var blob = new Blob([data], { type: 'text\/csv;charset=utf8;filename='+filename });\n                var csvUrl = URL.createObjectURL(blob);\n                var a = document.createElement('a');\n                a.setAttribute('style', 'display:none');\n                a.setAttribute('href', csvUrl);\n                document.body.appendChild(a);\n                a.click()\n            }\n        }\n    })\n<\/pre>\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-it-chef\uc758-\uc77c\uc0c1-\ube14\ub85c\uadf8 wp-block-embed-it-chef\uc758-\uc77c\uc0c1-\ube14\ub85c\uadf8\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"1IceGrVQIp\"><a href=\"https:\/\/www.itchefblog.com\/?p=1896\">Spring Boot\uc5d0\uc11c CSV \ucd9c\ub825 \uae30\ub2a5 \ub9cc\ub4e4\uae30<\/a><\/blockquote><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Spring Boot\uc5d0\uc11c CSV \ucd9c\ub825 \uae30\ub2a5 \ub9cc\ub4e4\uae30&#8221; &#8212; IT + CHEF\uc758 \uc77c\uc0c1 \ube14\ub85c\uadf8\" src=\"https:\/\/www.itchefblog.com\/?p=1896&#038;embed=true#?secret=1IceGrVQIp\" data-secret=\"1IceGrVQIp\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\ubc14\ub85c \uc774\uc804 \ud3ec\uc2a4\ud305\uc5d0\uc11c\ub294 Spring Boot\uc5d0\uc11c CSV \ucd9c\ub825\ud558\ub294 \ubc29\ubc95\uc744 \ud3ec\uc2a4\ud305 \ud588\ub294\ub370, \uc774\ubc88\uc5d0\ub294 \ubc1b\uc544\uc628 response\ub370\uc774\ud130\ub97c JS \ub97c \uc774\uc6a9\ud558\uc5ec \ud30c\uc77c\ub85c \uc800\uc7a5\ud558\ub294 \ubc29\ubc95\uc744 \uac04\ub2e8\ud788, \ucf54\ub4dc\ub9cc, \uc791\uc131\ud574\ubcf8\ub2e4. ajax call\uc740 jQuery\ub97c \uc774\uc6a9\ud588\uc9c0\ub9cc \ud30c\uc77c \uc800\uc7a5\ubd80\ubd84\uc740 javascript \ub97c \uc774\uc6a9\ud588\uae30\uc5d0 axios\ub97c \uc774\uc6a9\ud558\ub4e0 \ubb58 \uc774\uc6a9\ud558\ub4e0 \uac04\uc5d0 CSV \ub370\uc774\ud130\ub97c \ud30c\uc77c\ub85c \uc800\uc7a5\uc2dc\uc5d0 \ud65c\uc6a9 \uac00\ub2a5\ud55c \ucf54\ub4dc\uc774\ub2e4.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,10,4,11],"tags":[98,342,648,656,657,658,659],"_links":{"self":[{"href":"https:\/\/www.itchefblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1899"}],"collection":[{"href":"https:\/\/www.itchefblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itchefblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itchefblog.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itchefblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1899"}],"version-history":[{"count":3,"href":"https:\/\/www.itchefblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1899\/revisions"}],"predecessor-version":[{"id":1903,"href":"https:\/\/www.itchefblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1899\/revisions\/1903"}],"wp:attachment":[{"href":"https:\/\/www.itchefblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itchefblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itchefblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}