success: function(data) {
if ( data === 'ok' ) {
// делаем если ok
} else {
// иначе
}
}
public function getCountComments($period = false) {
$query = self::find();
if($this->post_id) {
$query->where(['post_id' => $this->post_id]);
}
if($this->type) {
$query->andWhere(['type' => $this->type]);
}
if($period == 'day') {
$query->andWhere('date_create>=CURDATE()');
}
return $query->count();
}
$children_query = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 6,
'post_parent' => 29
) );
$children = $children_query->get_posts();
<a href="/comments/default/vote" class="upvote"> </a>
<script>
var ajax = {
voteUrl: '/comments/default/vote',
...
};
</script>