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-06-06 23:45:50 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
840e3b080da12278a14febc50bfdaf1f8f1d0dce
840e3b08
1 parent
ff920b31
Delete api받을수있는코드.js
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
38 deletions
api받을수있는코드.js
api받을수있는코드.js
deleted
100644 → 0
View file @
ff920b3
// 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('');
var
XMLHttpRequest
=
require
(
'xhr2'
);
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
)
{
//console.log('Status: '+this.status+'nHeaders: '+JSON.stringify(this.getAllResponseHeaders())+'nBody: '+this.responseText);
//console.log(this.responseText);
console
.
log
(
this
.
responseText
);
console
.
log
(
"hehe\n"
);
console
.
log
(
queryParams
);
}
};
xhr
.
send
(
''
);
\ No newline at end of file
Please
register
or
login
to post a comment