var vk = new XMLHttpRequest();
vk.open("GET", "https://api.vk.com/method/wall.get?owner_id=1&count=20&filter=all&v=5.45", false);
vk.send();
console.log(vk.text);
console.log(vk.photo_75);
VK.Api.call('wall.get', {owner_id: 1, fields: 'photo_130, text', count: '20', filter: 'all', v: '5.45'}, function(r) {
alert(r.response.text);
})
<div id="answerPlaceHolder"></div>
var placeHolder = $('#answerPlaceHolder');
var url = 'https://api.vk.com/method/wall.get?owner_id=1&count=20&filter=all&v=5.45';
var answer;
$.ajax
({
url: url,
type: 'get',
crossDomain: true,
dataType: 'jsonp',
success: function(response)
{
answer = response;
answer.response.items.forEach(function(item)
{
var item2Append = $('<div class= "postWrapper"></div>');
if((item.text != 'undefined') && (item.text != ''))
{
item2Append.append('<div class="postText">' + item.text + '</div>');
console.log(item.text);
}
if(
(typeof(item.attachments) !== 'undefined') &&
(item.attachments[0].type == 'photo') &&
(typeof(item.attachments[0].photo.photo_604) !== 'undefined')
)
{
item2Append.append('<img class="postImage" src="' + item.attachments[0].photo.photo_604 + '">');
console.log(item.attachments[0].photo.photo_604);
}
console.log('******************************\n');
if(item2Append.children().length != 0)
{
item2Append = item2Append.add('<hr>');
placeHolder.append(item2Append);
}
});
},
error: function(error)
{
console.log('Ошибка');
console.log(error);
}
});