self.onmessage = function (e) {
    const { type, ruta } = e.data;
    if (type === 'obtener_calles') {
          var fd = new FormData();
           var phpfile = ruta;
          var xhr = new XMLHttpRequest();
          xhr.open('POST', phpfile, true);
          xhr.onload = function () {
            var data = JSON.parse(this.response);
            self.postMessage({type:'datos_calles', data: data});
          };
          xhr.send(fd);
    } else if (type === 'obtener_datos_administrativos') {
          var fd = new FormData();
          var phpfile = ruta;
          var xhr = new XMLHttpRequest();
          xhr.open('POST', phpfile, true);
          xhr.onload = function () {
            var data = JSON.parse(this.response);
            self.postMessage({type:'datos_administrativos', data: data});
          };
          xhr.send(fd);
    }
  };


