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

107
Views
¿Cómo puedo pasar la base de reenvío de datos sobre lo que hace clic el usuario?

He estado probando la obtención de datos de una API de acciones y estoy mostrando el símbolo de cotización y el nombre en mi página. Sin embargo, quiero expandirme un poco y cuando hago clic en cada acción me gustaría que se abra una página y mostrar más datos sobre ese stock. Entonces, mi enfoque del problema es hacer que una función realice una solicitud usando el símbolo de cotización como argumento cuando se abre la página de detalles. Pero mi pregunta es cómo paso el ticker a mi función. ¿Alguien puede ayudar?

 // Fetch stock- this function runs on page load async function fetchTrendingStock() { fetch(trendUrl) .then(response => { if(!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } return response.json(); }) .then(data => { console.log(data) let trend = ""; let payload = data.data.all; for(let i = 0, len = payload.length; i < len; i++) { trend += ` <div class="col-lg-6"> <a class="cardLink" href="details.html"> <div class="newsCard"> <div class="text-container"> <h4 class="cardText">${payload[i].name}</h4> <h5 class="cardText">${payload[i].ticker}</h5> </div> <div class="imgContainer"> <p class="">${payload[i].sentiment_score}</p> </div> </div> </a> </div> ` } document.getElementById("trend-stocks-container").innerHTML = trend; }) } fetchTrendingStock() // fetch stock details- this function will run when the link to the stock is clicked to open the detail page. async function fetchProfileData(ticker) { let url = `https://financialmodelingprep.com/api/v3/profile/${ticker}?apikey=0000`; fetch(url) .then(response => { if(!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } return response.json(); }) .then(data => { console.log(data) data.forEach(payload => { console.log(payload.companyName) console.log(payload.description) }) }) } fetchProfileData("eman")
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!