I have multiple pages which contains multiple ajax forms. When I am working on a particular form, its ajax submission is working. But at that moment, if I go to second page form, ajax submission not working and the page gets reloaded.
But after clearing cache, if I work on second page form, its ajax submission working, but then first page ajax form submission not working.
How will I manage multiple ajax forms on multiple pages?
My ajax submission code looks like this:
$form['actions']['submit'] = array( '#type' => 'submit', '#value' => $this->t('Submit'), '#attributes' => array('class' => array('btn-red')), '#ajax' => [ 'callback' => '::submitCallBack', 'progress' => array( 'type' => 'throbber', 'message' => 'Please wait...', ), ], );