S
S
Silverviql2018-05-11 15:01:40
Yii
Silverviql, 2018-05-11 15:01:40

How to stay on the same page on the site when clicking on a link?

How to call an action without following the link?
now I have it like this:
<?= Html::a('Delivered', ['courier/delivered','id' => $courier->id], ['class' => 'btn btn-xs done' ]) ?>
This is a link following where it calls the action delivered by id and overwrites the value in the database.
I need it to pass the value but not follow the link.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Timofeev, 2018-05-11
@Silverviql

How to stay on the same page on the site when clicking on a link?

Send ajax (asynchronous) request.
Or using jquery:
api.jquery.com/jquery.ajax
or using pjax
https://www.yiiframework.com/doc/api/2.0/yii-widge...

A
Anton, 2018-05-11
@Eridani

<a href="#" onclick="foo(); return false;">

I
Ivan Ivanov, 2018-05-11
@ZZiliST

<a nohref>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question