Toggle navigation
Toggle navigation
This project
Loading...
Sign in
오세헌
/
Ingredient-to-Dish-ChatBot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
오세헌
2022-05-31 23:11:36 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
82bf9f14cd848b1ead5e27436c733a0a807199bc
82bf9f14
1 parent
ab2485f3
api 받을수있는 코드 업로드
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
api받을수있는코드.js
api받을수있는코드.js
0 → 100644
View file @
82bf9f1
var
xhr
=
new
XMLHttpRequest
();
var
url
=
'http://apis.data.go.kr/1390802/AgriFood/FdCkry/getKoreanFoodFdCkryList'
;
/*URL*/
var
queryParams
=
'?'
+
encodeURIComponent
(
'serviceKey'
)
+
'='
+
'R7bFhjvvAMmxJxzcrL8NWkYHVa227zfpwvpwgXxcixNdMY0EbdbsbCboj3zXEsXniKNHyqu2dEllJCRk1LsdxA%3D%3D'
;
/*Service Key*/
queryParams
+=
'&'
+
encodeURIComponent
(
'service_Type'
)
+
'='
+
encodeURIComponent
(
'xml'
);
/**/
queryParams
+=
'&'
+
encodeURIComponent
(
'Page_No'
)
+
'='
+
encodeURIComponent
(
'1'
);
/**/
queryParams
+=
'&'
+
encodeURIComponent
(
'Page_Size'
)
+
'='
+
encodeURIComponent
(
'20'
);
/**/
queryParams
+=
'&'
+
encodeURIComponent
(
'food_Name'
)
+
'='
+
encodeURIComponent
(
'밥'
);
/**/
queryParams
+=
'&'
+
encodeURIComponent
(
'ckry_Name'
)
+
'='
+
encodeURIComponent
(
'조리'
);
/**/
xhr
.
open
(
'GET'
,
url
+
queryParams
);
xhr
.
onreadystatechange
=
function
()
{
if
(
this
.
readyState
==
4
)
{
alert
(
'Status: '
+
this
.
status
+
'nHeaders: '
+
JSON
.
stringify
(
this
.
getAllResponseHeaders
())
+
'nBody: '
+
this
.
responseText
);
}
};
xhr
.
send
(
''
);
\ No newline at end of file
Please
register
or
login
to post a comment