If you want to check it on the fly without submitting the form data to the server, you’ll have to use AJAX. Essentially an AJAX call will request a page on your server that does the query with the given parameters, then it returns the results (typically HTML or a JSON object). There are many different AJAX libraries to choose from
Examples: