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

96
Views
I want to link with the api

I want to link with the api but this link (https://api.fm-track.com/object-coordinates-stream.json?version=2&api_key=1g6F9NvaKY4jsnmrLqmzxILIMhTpncwr) every time I try to link it with my site

I can't why

this code

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />


    <link href="https://fonts.googleapis.com/css?family=Dosis:400,700" rel="stylesheet" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script>
      $(document).ready(function() {
        $.ajax({
          url: "https://api.fm-track.com/object-coordinates-stream.json?version=2&api_key=1g6F9NvaKY4jsnmrLqmzxILIMhTpncwr",
          type: "GET",
          success: function(result) {
            console.log(result);
          },
          error: function(error) {
            console.log(error);
          }
        });
      });
    </script>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your API actually return text/event-stream which is is the official media type for Server Sent Events (SSE)

You can accept SSE like this:

      const evtSource = new EventSource("https://api.fm-track.com/object-coordinates-stream.json?version=2&api_key=1g6F9NvaKY4jsnmrLqmzxILIMhTpncwr");
evtSource.onmessage = function(event) {
  const newElement = document.createElement("li");
  const eventList = document.getElementById("list");
    const data = JSON.parse(event.data);
    console.log(data);
  newElement.textContent = "message: " + data['object_id'];
  eventList.appendChild(newElement);
}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />


    <link href="https://fonts.googleapis.com/css?family=Dosis:400,700" rel="stylesheet" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  </head>
  <body>
    <ul id="list"></ul>
  </body>
</html>

For more details:

https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events

https://www.w3schools.com/html/html5_serversentevents.asp

https://stackoverflow.com/a/52099962/11250643

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!