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

210
Vistas
JQuery function - Run it automatically once a day instead of a on click action

We have a WordPress theme serving as an online directory. This theme uses a JSON file to display our listings on our map. For each of our modifications on a listing we must click on a button named "JSON Generator" to update the data of the map.

The problem is that we are currently adding/modifying a lot of content on our map so it requires a lot of manual regenerations.

Screenshot of the button and the HTML declaration

Is there a way to replace the click launch of the JavaScript function regenerating the JSON by an automatic launch every 24 hours for example?

Here is the start of my actual .js file :

;(function($) {
  // Json Generator
  var directoryManagerAdmin = function() {
    this.param = lava_dir_admin_param;
    this.init();
  }

  directoryManagerAdmin.prototype.constructor = directoryManagerAdmin;
  directoryManagerAdmin.prototype.init = function() {
    var self = this;

    $(document)
      .on('click', '.lava-data-refresh-trigger', this.onGenerator())
      .on('click', '.fileupload', this.image_upload())
      .on('click', '.fileuploadcancel', this.image_remove())

    $('button[data-listing-type-generator]').each(function() {
      var listingType = $(this).data('listing-type-generator') || false;
      var Instance = self.onGenerator(listingType);
      $(this).on('click', Instance);
    });

    self.bindJsonEditor();
  }

  directoryManagerAdmin.prototype.onGenerator = function(type) {
    // THEN YOU HAVE THE VERY LONG FUNCTION...

I think that I have to replace the launcher: .on( 'click', '.lava-data-refresh-trigger', this.onGenerator() ) with an automatic launcher every 24 hours or so.

I found out how to get the current date: var date = new Date().toLocaleDateString();, I also know that I may have to use the setInterval action but I don't know how to use it.

Thanks by advance if you have any clue to help me !

about 4 years ago · Juan Pablo Isaza
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