There is site.com with search. when searching for redirects to site.com/search/node/your_query (drupal)

There is an HTML page on a subdomain, such as test.site.com on it Input and Button

How do I get to drive (for example) a search query "test" into a form in the subdomain test.site.com and press the button to transfer me to the main domain site.com/search/node/test (search imitation on the subdomain) in javascript I zero almost

    1 answer 1

    Go to your main site, and look at the code of the search form in the object inspector (right-click on the form - the "show code" item - find the form tag in the DOM tree in the inspector).

    • In the form tag you will see the action attribute with the path to the correct search route. For example, before /search/node
    • In the input tag inside the form, you will see the name attribute with the correct name of the search text field. For example, search_query

    Now on your subdomain - just build the same form with the same field:

     <form id="search" action="//site.com/search/node" method="get"> <input type="text" name="search_query"/> <input type="submit"/> </form> 

    Pay attention to the method="get" form - search forms usually send data to the server with a GET request, but perhaps in your case the form is sent using the POST method - look how it is done in the form on the main domain and do the same.

    Also, the button can have type="submit" , or type="search" , also do it in the main form.

    As a result, you will receive a working search form that takes you from the subdomain to the main domain, without javascript.