Answer the question
In order to leave comments, you need to log in
How to get information about the VK API group?
Hello! Who will tell me why I can not get information about the group? It seems that I set access-control-allow-origin in headers, but the code still does not work.
axios.get('https://api.vk.com/method/users.get',{
params:{
user_id:210700286,
v:5.52
},
headers:{
'Content-Type':'application/json',
'Access-Control-Allow-Origin':'*'
}
})
.then((response) =>{
console.log(response)
})
.catch((error) =>{
console.log(error)
})
Answer the question
In order to leave comments, you need to log in
The browser adds its origin header. As far as I understand Access-Control-Allow-Origin
, JS solves little, so I used CORS Proxy.
$.ajax({
type:'POST',
url: 'https://cors-anywhere.herokuapp.com/http://aiproject.ru/api/',
'data': {
query: '{"ask":"'+message+'","userid":'+id+',"key":"1"}'
},
'success': function(data){
msg = JSON.parse(data);
$(".messages").append('<li><div class="text-msg receive_msg">'+msg['aiml']+'</div></li>');
while($(".messages li").length > 7){
$('li:first').detach();
}
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question