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

217
Visualizações
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 à 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