Answer the question
In order to leave comments, you need to log in
How to make a search in node.js on a page with a selection from the database and then display the result?
Good afternoon please help!
Briefly. Here is the .ejs page. Here the user enters data in the field and clicks the find button
<div id="search-username">
<p class="search-title">Find username</p>
<input type="text" id="search-your-username" class="input-search" name="search" placeholder="Search for...">
<button class="button-search" id="button-search-username">SEARCH</button>
</div>
$(document).ready(function(){
$(".button-search").on("click", function(){
var id = $("#search-your-username").val();
})
});
router.get('/search', async (req, res) => {
const isUser = User.findOne({
});
res.render('search', {isUser});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question