Код: Выделить всё
$('#1').click(function() { if ($('#friends_list option:selected').val()!='') { if ($('#message_tf').val()!='') { uid_to = friends_data[$('#friends_list option:selected').val()].uid; message_to = $('#message_tf').val(); VK.api('wall.post',{owner_id:uid_to, attachment:'photo-36977864_281547885', message:message_to},function(data) { if (data.response) { alert('Сообщение отправлено! ID сообщения: ' + data.response.post_id); } else { // ошибка при отправке сообщения alert('Ошибка! ' + data.error.error_code + ' ' + data.error.error_msg); } }); } else { alert('Введите сообщение!'); } } else { alert('Выберите пользователя!'); } return false;});