---
# System prepended metadata

title: Untitled

---

Alexar:

/privigen-dosage-calculator
callback:
Controller::calculator

-----
echo render('page', []);

GET
<div>
    <result></result>
    <button href="/privigen-dosage-calculator/email">
      Send Email
    </button>
</div>

--------------------------------

Route: 
/privigen-dosage-calculator/email

callback:
Controller::email

class Controller {

    function calculator() {
        
    }
    
    function email() {
        $result = getResultFromFileOrDatabase();
    }

}


Vahab:



$form['actions']['submit'] = [
        '#type' => 'submit',
        '#value' => $this->t('Calculate'),
        '#ajax' => [
          'callback' => [$this, 'rebuildResult'],
          'event' => 'click',
          'wrapper' => 'field-result',
          'progress' => [
            'type' => 'throbber',
            'message' => 'Getting you the result, please wait ...',
          ],
        ],
      ];

