Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
Changing a param with a html input request

I'm trying to change two dates which determine a range of days, on those days we can see which asteroids where closeby earth. I'm using axios to make the request to my api and I have to params that need to change with an html input but I'm not able to change them properly, or I can't find the way, can someone help me? thanks!!!!

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Pruebas API</title>
</head>
<body>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script src="js/api_nasa.js"></script>
    <label for="Fecha comienzo">Fecha de comienzo aaaa/mm/dd</label>
    <div></div>
    <input type="text" id="start_date" name="Fecha comienzo"></input>
    <button onclick="actualizarFecha()">Entrar</button>
</body>
</html>

And my javascript

function actualizarFecha(){
    
    var input = document.getElementById("start_date").value;
    console.log(input)
    buscarAsteroide();
   // return input;
    buscarAsteroide(input)
    } 

const buscarAsteroide  = async(fechaInicio, fechaFinal) => {
    console.log(fechaInicio)
    try {
        const respuesta = await axios.get('https://api.nasa.gov/neo/rest/v1/feed?', {
            params: {
                start_date: '2021-04-09',
                end_date: '2021-04-10',
                api_key: 'cant't show u this',
            }
            
        })
        console.log(respuesta.data);
    } catch(error) {
        console.log(error);
    }

}

buscarAsteroide();

once again, thanks!
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!