Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Пример работы с подсказками DaData на JScript + XMLHTTP
var API_KEY = "ВАШ_API_КЛЮЧ";
function suggest(resource, query) {
var http = new ActiveXObject("MSXML2.XMLHTTP");
http.open("POST", "http://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/" + resource, false);
http.setRequestHeader("Content-Type", "application/json");
http.setRequestHeader("Authorization", "Token " + API_KEY);
var data = "{ \"query\": \"" + query + "\" }";
http.send(data);
return http.responseText;
}
resp = suggest("party", "7719402047");
WScript.Echo(resp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment