I write a project on Yii2, and I make one button, “Rate”, the user clicks on it, and the ajax should transfer the data to the controller and the action, everything works fine in opera and chrome, but Firefox does not give in to any. That is, in the firefox user throws a link to this action right in the browser. And yes, probably googled the entire Internet, did not help. The version of Firefox is 52.0.1. Has anyone come across this at all? Here are all the variations that I have already done, and which did not lead to success.
$('.like-btn').on('click', function(e) { e.preventDefault(); $('.like-btn').on('click', function(e) { e = $.event.fix(e); e.preventDefault(); $('.like-btn').on('click', function(event) { event.preventDefault ? event.preventDefault() : (event.returnValue = false); And of course the option where at the end return false; (also did not work)
Yii2:
<?= Html::a(Html::button(Html::img(Yii::getAlias("@web") . '/images/like-unactive.png', ['width' => '20px', 'class' => 'like-btn', 'data-id' => $photo->id ]), ['class' => 'floating-like', 'name' => 'like', 'value' => $photo->id]), ['profile/like', 'id' => $photo->id]) ?> HTML:
<a href="/profile/like?id=50"> <button type="button" class="floating-like" name="like" value="50"> <img class="like-btn" src="/images/like-unactive.png" width="20px" alt="" data-id="50"> </button> </a>
function(e) { ...is fulfilled. Insert there the first linealert("Click");. - Igor