<script>
$(function () {
$('form').submit(function( event ) {
var data = $(this).serialize().replace(/[^&]+=&/g, '').replace(/&[^&]+=$/g, '');
$.ajax({
type: 'GET',
url: '/search'+data,
data: data,
success: function(output, status, xhr) {
history.pushState({foo: 'bar'}, 'title', '/search'+data);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status + thrownError);
}
});
return false;
});
});
</script>
history.pushState({foo: 'bar'}, 'title', this.url);
<?php \yii\widgets\Pjax::begin(); ?>
<span>Рейтинг 256</span>
<a href="/vote?id=айдизаписи&plus=true">+</a>
<a href="/vote?id=айдизаписи&plus=false">+</a>
<?php \yii\widgets\Pjax::end(); ?>
public function actionVote($id,$plus){
$x=1
if($plus)
$x = -1;
$model = Chtoto::findOne($id);
$model->rating = $model->rating + $x;
if($model->save())
return $this->renderAjax('_вьюшка_Блока_рейтинга_и_кнопок',['rating'=>$model->rating]);
return false;
}