Answer the question
In order to leave comments, you need to log in
Ajax request to vk API in yii controller - what's the problem?
I am doing an ajax request to post to a group in VK. The entry is published, but the post_id does not return.
<?php
public function actionVip()
{
$message = "тестовая запись";
?>
<script type="text/javascript">
$.ajax({
url: "https://api.vk.com/method/wall.post?owner_id=-69173875&from_group=1&message=<?php echo(urldecode($message)); ?>&access_token=$token&v=3.0",
//dataType: "json",
type: "POST",
success: function (data){
var result = jQuery.parseJSON(data);
if(result)
alert('Сообщение отправлено! ID сообщения: ' + result.post_id);
else
alert('Ошибка'+ result.post_id);
},
});
</script> <?php
$this->renderPartial('_ajaxVipValidate', $data="1", false, false);
}
?>
Answer the question
In order to leave comments, you need to log in
PHP brain?
Have you heard of views? What is MVC, do you know?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question