0

I really need your help. I'm new at it, so i dont get this thing. I have old project on Yii1, there is an ajax submit button. I thought that i can use this button in Yii2 but I've rear that Yii2 doesnt use CHtml. So here's my question, what can i do to 'remake' my button. I wanted to use it in new project (Yii2).

This part of code is for example:

<?php 
echo CHtml::ajaxSubmitButton(Yii::t('importcsvModule.importcsv', 'Import'), '', array('success' => 'function(response){
                                        $("#importCsvThirdStepResult").html(response);
                                        $("html, body").animate({scrollTop:$("#content").position().top}, "slow")
                                    }'), array("class" => "formbut"));
?>

I really need your help, I would be very grateful if you'll answer me.

  • There is no version of this in Yii 2. But you can easily attach JS handler for the button and do it from there. – Bizley Nov 10 '20 at 10:30
  • You can look here https://stackoverflow.com/questions/38156214/yii2-how-to-use-pjax-to-submit-a-form-without-refresh-the-page – ustmaestro Nov 12 '20 at 09:04

0 Answers0