如何使用PHP在表单提交页面上显示cURL响应

I am using Yii2 form to check the availability of a domain using cURL with http api.

my form data is like this:

<?php $form = ActiveForm::begin(['id' => 'domain-check']); ?>
<?= $form->field($model, 'domain')->textInput(['autofocus' => true]) ?>            
<?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',]) ?>

<div class="form-group">
<?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'Search']) ?>
 </div>
 <?php ActiveForm::end(); ?>

and in my controller -

public function actionDomain()
    {
      $model = new DomainCheckerForm();
      return $this->render('domainChecker', [
            'model' => $model,
        ]);

   if ($model->load(Yii::$app->request->post())) {              
            $domain=($_POST['DomainCheckerForm']['domain']);
            $domain_arr = explode(".", $domain, 2);
            $domain_name = $domain_arr[0];
            $domain_tld = $domain_arr[1];
            $user='xxxx';
            $password='xxxxx';
            $url= "https://httpapi.com/api/domains/available.json?auth-userid=$user&api-key=$password&domain-name=$domain_name&tlds=$domain_tld";
             $curl = curl_init();
            curl_setopt($curl, CURLOPT_URL,$url);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true );
            $result = curl_exec($curl);
            curl_close($curl);
            $data = json_decode($result, true);
           foreach($data as $key => $val){
            $classkey = $val['classkey'];
            $status = $val['status'];
}           
            if($status=='available'){
            echo 'Congratulation' . $domain.' is available';
            }else{
                echo 'Sorry' .$domain. 'is not available';
            }  
      }
    }

If I am using the part of curl in a separate action and adding that action to the form, I am getting the response but on a different page.

If I am keeping the code the same as it is, nothing shown as response except the form.

How Can I show the cURL response on the form Submit Page?

Do I need to use Jquery to achieve the same?