I successfully configured mongoosastic, I tried searching and it works fine, but when it comes to the interface, I’m not quite sure how to achieve this, I experimented with a lot of ways, but couldn’t come up with a good solution.
Here is the code.
// For the Search API router.post('/api/search/', function(req, res, next) { Job.search( { query_string: { query: req.body.search } } , function(err, results) { if (err) return next(err); res.json(results); }); });
So whenever I look for something that is related to an “engineer”, I get json data

Thus, the backend works just fine.
However, when it comes to jquery and ajax, I get a bad request all the time
Logic: whenever something is inserted, post it and find this result.
Here's the jQuery code for the interface.
$('#search').keyup(function() { var search_term = $(this).val(); $.ajax({ type: "POST", url: "/api/search", success: function(){ $('search_results').html(search_term); }, error: function(data){ alert('Error', data); } }); });
HTML
<input type="text" class="form-control input-lg" id="search" name="search" placeholder="Search for part-time..." /> <div id="search_results"> </div>
How to insert json results in search_results ?