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

177
Views
replace getJSON jquery function with pure js using local variable

I have a getJSON jquery function that uses data from an external file eg

$.getJSON( "data/dataset.json", function( data ) {
    var mygeojson = {
        type: "FeatureCollection",
        features: [],
    };
    var waypoints = []
    var all_points=[]
    for (i = 0; i < data.length; i++) {
            var lng = data[i].lng;

.....

I now have a local variable that contains the same data as the external data file.

eg

const dataset = [{..}, {..},......]

The data is in the exact same format.

How can I use a pure js function that references the dataset variable rather than the jquery getjson function?

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

0

Lets say you have a file with the following code as the data,

datasetFile.js

export const dataset = [{..}, {..},......];

and you have another file where you want to use this data

useDataset.js

import { dataset } from './datasetFile.js
console.log(dataset);

You should be good to go.

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!