Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!