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

198
Views
Escribir en una respuesta api <p>

Estoy tratando de obtener una respuesta de esta API: https://spen.tk/api/v1/isScamLink

La respuesta de la API se ve así:

 {"status":200,"result":true,"linkFound":""}

Quiero obtener la parte del resultado en una var y usarla en un párrafo en HTML.

Este es mi código js en el sitio:

 <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(function() { $.ajax({ url: 'https://spen.tk/api/v1/isScamLink?link=' + document.getElementById("box").value, type: 'GET', dataType: 'json', success: function(response) { var result = response.data.total; var final = $('#result').text(result); } }) }) </script>

Dice este error: Uncaught TypeError: Cannot read properties of undefined (reading 'total')

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Su respuesta json no contiene la clave 'datos', por eso está recibiendo un error.

about 4 years ago · Juan Pablo Isaza Report

0

Tus datos estarán en response.result

 $.ajax({ url: 'https://spen.tk/api/v1/isScamLink?link=https://google.com', type: 'GET', dataType: 'json', success: function(response) { console.log(response.result) } })
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

about 4 years ago · Juan Pablo Isaza Report
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!