Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

187
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda