0

I want guidance to find a solution to my problem in the development of my application. I want to reuse the content of the input tag that is present my form created in another code of Node.js

For Example: If I enter the keyword nodejs in the input tag of my form "index.html".

I want to reuse this keyword nodejs in the following line

app.search('Query', 5, function(error, result)

and instead of the word Query I want this line to receive the new keyword nodejs and on every time I enter a new keyword in the form it will be taken into consideration in my nodejs file "search.js".

I do not know how to bind an HTML form and a nodejs code

Thank you so much in advance

h.ibn
  • 9
  • 3
  • Your question is too broad at the moment. How are you processing requests in Node.js at the moment? Are you using any framework, such as Express? What does the form look like? Are you making a standard GET request? Is the search term appearing in the URL? – Quentin Mar 04 '19 at 11:03
  • Why are you using a POST form for a search? This is the sort of thing GET is designed for. – Quentin Mar 04 '19 at 11:16
  • Duplicate: https://stackoverflow.com/questions/5710358/how-to-retrieve-post-query-parameters – Quentin Mar 04 '19 at 11:18
  • yes i use express as framework and mongodb as database, Thesearch term didn't appear in the URL and my form is like this:
    – h.ibn Mar 04 '19 at 11:19

0 Answers0