I just want to know is there any concept of Layout handle auto forward / redirection concept available ? Let me Explain in detail.

  1. Step-1: I have a controller folder called "Test" and action file name "Index"
  2. Step-2: I have another controller folder called "Index" and action file name "Index"
  3. Step-3: Actually I should create 2 layout handles to display the pages
    1. routeid_test_index.xml
    2. routeid_index_index.xml
      But I did create only one layout handle called "routeid_index_index.xml" And one of my form action I have given action name as "frontname/test/index" but I am seeing the "frontname/index/index" action execution and it is loading "routeid_index_index.xml" file block class and template content.

Is there any possibility to happen like this in magento 2 ? [I am using magento 2.3.4 version]

  • Is the "frontname/test/index" page? or just action? If it's a page, then you need to create the XML file.
    – Aaron Wang
    Sep 16, 2022 at 17:39
  • no it's just an action. in this case will it auto redirect to "routeid_index_index.xml" or "frontname_index_index" action..? Sep 19, 2022 at 8:19
  • I understood what you need.
    – Aaron Wang
    Sep 19, 2022 at 17:15

1 Answer 1


In this case, you have to create ajax call and receive the values from it.

<script type="text/javascript">
    require(['jquery'], function($){ 
       var url = "<?php echo $this->getUrl() . 'frontname/test/index' ?>";

           var formData = JSON.stringify( $('#your_formid').serializeArray() );
              url: url,
              type: 'POST',
              dataType: 'json',
              data: formData,
              success: function(response) {
                //excutes your code here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.