I am trying to add to the below async call in javascript which sends parameter q=<query>
, the second parameter l=<lquery>
, but I don't see it sent out.
var searchbox = $('input#search');
var langquery = $('input#fav_language');
var timer = 0;
// Executes the search function 250 milliseconds after user stops typing
searchbox.keyup(function () {
clearTimeout(timer);
timer = setTimeout(search, 250);
});
async function search() {
// Clear results before searching
noresults.hide();
resultdiv.empty();
loadingdiv.show();
// Get the query from the user
let query = searchbox.val();
// Only run a query if the string contains at least three characters
if (query.length > 2) {
let lquery = langquery.val();
// Make the HTTP request with the query as a parameter and wait for the JSON results
let response = await $.get(apigatewayendpoint, { q: query, l: lquery, size: 25 }, 'json');
CodePudding user response: