Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

126
Visualizações
adding parameter from html form to jquery string

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, checked in dev tools console

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');

the html body is below. i've tried referring to the radio form id an to the input name, both didn't worked

<body>
  <h1>InfoLang - Movie Plot At Your Language</h1>
        
  <form id="lang">
  <p>Please select language:</p>
  <input type="radio" id="it" name="fav_language" value="Italian">
  <label for="it">Italian</label><br>
  <input type="radio" id="fr" name="fav_language" value="French">
  <label for="fr">French</label><br>
  <input type="radio" id="he" name="fav_language" value="Hebrew">
  <label for="he">Hebrew</label>
  <br>  
  </form>
  
   
  <hr>
  <input id="search" autocomplete="off" placeholder="Search your movie" align="center">
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

i got this by-

if (query.length > 2) {
    let lquery
    if (document.getElementById('it').checked) lquery = 'it'
    if (document.getElementById('fr').checked) lquery = 'fr'
...

and for the display

let title = results[item]._source.title
        if (lquery == 'it') plot = results[item]._source.description_it
        if (lquery == 'fr') plot = results[item]._source.description_fr
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda