Giter VIP home page Giter VIP logo

Comments (4)

calvinmetcalf avatar calvinmetcalf commented on June 9, 2024

what exactly is the problem?

var povertyLayerTracts = new L.GeoJSON.AJAX("./data/ne/us-states.json",  {
        smoothFactor: 0,
        style: getStyle,
        onEachFeature: onEachFeature
    });

    var raceLayerTracts = new L.GeoJSON.AJAX("./data/ne/us-states.json",  {
        smoothFactor: 0,
        style: getStyle2,
        onEachFeature: onEachFeature
    });

should be fine, though if you want to avoid requesting it twice you can just manually do an ajax call

from leaflet-ajax.

petulla avatar petulla commented on June 9, 2024

It makes the request twice, downloading the same data twice. Can you explain how to manually do an ajax call in this context?

from leaflet-ajax.

petulla avatar petulla commented on June 9, 2024

Something like ..

var povertyLayerTracts;

$.getJSON( "test.json", function( data ) {
       povertyLayerTracts = l.geoJson(data,  {
        smoothFactor: 0,
        style: getStyle,
        onEachFeature: onEachFeature
    });
});

Seems to do the trick.

from leaflet-ajax.

calvinmetcalf avatar calvinmetcalf commented on June 9, 2024

There is an Ajax function included in this library as well if you don't
want to include jquery

On Sat, Aug 29, 2015, 5:04 PM Sam Petulla [email protected] wrote:

Closed #36 #36.


Reply to this email directly or view it on GitHub
#36 (comment).

from leaflet-ajax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.