How to use HTML Forms inside <script> tags or in a function()

How to use HTML Forms inside <script> tags or in a function()

I have a select options box to choose a query. Select All, Select by State etc. I have one choice which requires further input - Search by Partial Name. Is there a way to do this by having a <form> show up inside a script or function. I would then use $("#partname").on('click'. function() { put form in here and use input.val() to get the value to Return}.

Summary: One choice can use AJAX directly to get info from Database.
                 Another choice requires further input  before using AJAX to get info from Database.

Thanks for help.