<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<select id="list" name="select">
<option value="0">1 группа</option>
<option value="1">2 группа</option>
</select>
<input id="wall1" type="submit" onclick="post_group()">
<script>
//var xhr = new XMLHttpRequest();
//xhr.open('GET', 'test.json', false);
//xhr.send();
//if (xhr.status != 200)
//{
//alert( xhr.status + ': ' + xhr.statusText );
//} else
//{
//alert( xhr.responseText );
//}
//jQuery( document ).ready(function()
function clear()
{
document.getElementById('img').innerHTML = '';
}
function post_group()
{
clear();
var group = jQuery('#list').val();
var obj_group;
jQuery.ajax(
{
//r:\home\localhost\www\joomla\modules\module_vk\
type: "POST",
url: 'r:/home/localhost/www/joomla/modules/module_vk/group.php',
dataType: 'json',
data:{select:group},
async:false,
success: function(group)
{
obj_group = jQuery.parseJSON(group);
}
});
jQuery.ajax(
{
type: "POST",
url: "r:/home/localhost/www/joomla/modules/module_vk/test.php",
dataType: 'json',
data: {select:group},
async:false
})
.done(function(wall)
{
var obj = jQuery.parseJSON(wall);
console.log(obj);
for(var i=0;i<50;i++)
{
var groups=obj_group.response[0];
var item = obj.response.items[i]/*.copy_history[0].attachments[0].photo.photo_604*/;
jQuery('#img').append("<img src='"+groups.photo_50+"'> ");
jQuery('#img').append("<a href=http://vk.com/"+groups.screen_name+">"+groups.name+"</a></br>");
if((typeof item.copy_history == 'undefined')&&(typeof item.attachments!='undefined'))
{
if(typeof item.text!='')
{
jQuery('#img').append("<p style=margin-left:53>"+item.text+"</p>"+"</br>");
if(typeof item.attachments[0].photo!='undefined')
{
var img = item.attachments[0].photo.photo_604;
jQuery('#img').append("<img hspace=50 src='"+img+"'></br>");
}
}
else if(typeof item.attachments[0].photo!='undefined')
{
var img = item.attachments[0].photo.photo_604;
jQuery('#img').append("<img hspace=50 src='"+img+"'></br>");
}
/*else if(typeof item.attachments[0].doc!='undefined')
{
var po=item.attachments[0].doc.url;
console.log(po);
$('#img').append("<a href="+po+">Документ</a></br>");
}*/
}
else if((typeof item.attachments == 'undefined')&&(typeof item.copy_history!='undefined'))
{
if(typeof item.text!='')
{
jQuery('#img').append("<p style=margin-left:53>"+item.text+"</p>"+"</br>");
}
var img = item.copy_history[0].attachments[0].photo.photo_604;
jQuery('#img').append("<img hspace=50 src='"+img+"'></br>");
}
else
{
jQuery('#img').append("<p style=margin-left:53>"+item.text+"</p>"+"</br>");
}
}
jQuery("#msg").html(result);
});
}
</script>
<div id="img"></div>