Yii2 how to use Response of ajax validation in javascript?

i use ajax validation that return

return ActiveForm::validate($model);

i want to call js function after return success
i dont know how can i call js function
for example:

if($model->validate){
return <<<JS
        alert("success");
JS;
"
}