Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

179
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda