How to use the jquery.getJSON function in jquery

To help you get started, we’ve selected a few jquery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github viserjs / viserjs.github.io / pages / demo / examples / map / example5 / react.tsx View on Github external
componentDidMount() {
    $.when($.getJSON('/assets/data/usa.geo.json'),
      $.getJSON('/assets/data/flights-airport.json'),
      $.getJSON('/assets/data/airport.json'))
    .then((mapData, flights, airports) => {
      mapData = mapData[0];
      flights = flights[0];
      airports = airports[0];

      var map = [];
      var features = mapData.features;
      // 获取出所有的地图区域名称
      for (var i = 0; i < features.length; i++) {
          var name = features[i].properties.name;
          map.push({
              "name": name
          });
      }
github grafana / worldmap-panel / src / worldmap_ctrl.ts View on Github external
type: "GET",
        url: this.panel.jsonpUrl + "?callback=?",
        contentType: "application/json",
        jsonpCallback: this.panel.jsonpCallback,
        dataType: "jsonp",
        success: res => {
          this.locations = res;
          this.render();
        }
      });
    } else if (this.panel.locationData === "json endpoint") {
      if (!this.panel.jsonUrl) {
        return;
      }

      $.getJSON(this.panel.jsonUrl).then(res => {
        this.locations = res;
        this.render();
      });
    } else if (this.panel.locationData === "table") {
      // .. Do nothing
    } else if (
      this.panel.locationData !== "geohash" &&
      this.panel.locationData !== "json result"
    ) {
      $.getJSON(
        "public/plugins/grafana-worldmap-panel/data/" +
          this.panel.locationData +
          ".json"
      ).then(this.reloadLocations.bind(this));
    }
  }
github autowp / autowp / assets / gallery / index.ts View on Github external
if (page) {
            var loaded = false;
            var status = self.pageStatus[page];
            if (status == 'loading' || status == 'loaded') {
                loaded = true;
            }
            if (loaded) {
                if (callback) {
                    callback();
                }
                return;
            }

            self.pageStatus[page] = 'loading';
        }
        $.getJSON(this.url, { pictureId: pictureId, page: page }, function(
            json
        ) {
            self.count = json.count;
            self.pages = json.pages;

            if (!self.pageStatus[self.pages]) {
                self.pageStatus[self.pages] = null;
            }
            self.pageStatus[json.page] = 'loaded';

            let $activeItem: JQuery | undefined = undefined;

            var offset = self.perPage * (json.page - 1);
            for (let idx in json.items) {
                let item = json.items[idx];
                var position: number = offset + Number(idx);
github CartoDB / cartodb / lib / assets / javascripts / cartodb / data_library / header / view.js View on Github external
load: function() {
    this.map = L.map(this.$("#DataLibraryMap")[0], {
      zoomControl: false,
      attributionControl: false
    }).setView([44,-31], 3);

    var sqlDomain = cdb.config.get('sql_api_template').replace('{user}', cdb.config.get('data_library_user'));
    var geojsonURL = sqlDomain + '/api/v2/sql?q=' + encodeURIComponent("select * from world_borders") + '&format=geojson&filename=world_borders';
    $.getJSON(geojsonURL).done(this._addGeojsonData);
  },
github viserjs / viserjs.github.io / pages / demo / examples / components / example15 / vue.vue View on Github external
mounted(){
        $.getJSON('/assets/data/baby-names.json', (data) => {
            var ds = new DataSet();
            var dv = ds.createView('demo').source(data).transform({
                type: 'fill-rows',
                groupBy: ['name'],
                orderBy: ['year']
            }).transform({
                type: 'impute',
                field: 'n',
                method: 'value',
                value: 0
            }).transform({
                type: 'aggregate',
                fields: ['n'],
                operations: ['sum'],
                groupBy: ['year', 'name'],
                orderBy: ['year'],
github ServiceStackApps / ReactChat / src / ReactChat / ReactChat / src / app.tsx View on Github external
onConnect: (u) => {
                    this.props.setActiveSub(u);

                    this.props.didConnect();
                    this.addMessages([{ message: "CONNECTED!", cls: "open" }]);

                    $.getJSON(this.props.chatHistoryUrl, r => {
                        this.addMessages(r.results);
                    });

                    this.props.refreshUsers();
                },
                onReconnect() {
github v4lli / meteocool / frontend / src / LayerManager.js View on Github external
downloadMainTiles (cb) {
    $.getJSON({
      dataType: "json",
      url: this.mainTileUrl,
      success: (data) => {
        this.switchMainLayer(new TileLayer({
          source: new TileJSON({
            tileJSON: data,
            crossOrigin: "anonymous",
            transition: 0
          }),
          opacity: this.opacity
        }));

        this.hook("timeHandler", data.version.toString());
        if (cb) { cb(data); }
      }
    });