Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7980473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:05:16+00:00 2026-06-04T10:05:16+00:00

I want to create an event with YUI where every two seconds, refresh the

  • 0

I want to create an event with YUI where every two seconds, refresh the page.

var companymain = {
init: function() {
  companymain.form = document.getElementById('companymain');
  //I need a event or something and repet this function.
  YAHOO.util.Event.addListener(companymain.form, 'EVENTNEED', companymain.submit_func);},

  submit_func: function(e) { //stuff refresh page}

ideas?
Regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:05:18+00:00Added an answer on June 4, 2026 at 10:05 am

    What you seem to want to do isn’t really an event sort of thing. The following shows the general idea that you need to implement:

    function repeatedRefresh(delay) {
       // Ajax code goes here
    
       setTimeout(repeatedRefresh, 2000);
    }    
    setTimeout(repeatedRefresh, 2000);
    

    This declares a repeatedRefresh() function and calls it after 2000ms. The function itself will do an Ajax call to update the page and then use setTimeout() to queue up another call to itself after 2000ms. I’d suggest putting the setTimeout() inside the Ajax completion/success callback so that subsequent calls happen 2000ms after the previous one completes.

    I’ve left the actual Ajax code out above because I’m not familiar with YUI (except in a very general way), but since you’ve tagged your question with jQuery this is one way to do it with jQuery:

    function repeatedRefresh(delay) {
       $.ajax({
          url : "yourURLhere",
          data : "optionalDataHere",
          // other ajax params here as needed,
          success : function(result) {
             // do something with result (display it on your page somehow),
             // then queue up the next refresh
             setTimeout(repeatedRefresh, 2000);
          }
       });       
    }    
    setTimeout(repeatedRefresh, 2000);
    

    Or if your server-side code is returning HTML you can simplify things by using the .load() method to automatically load the returned HTML into a particular element (say a div):

    function repeatedRefresh() {
       $('#elementToUpdate').load('yourURLhere', function() {
          setTimeout(repeatedRefresh, 2000);
       });
    }
    setTimeout(repeatedRefresh, 2000);
    

    Finally, to try to use your existing companymain structure:

    var companymain = {
       init: function() {
          setTimeout(companymain.submit_func, 2000);
       },
       submit_func : function() {
          // YUI or jQuery (or other) Ajax code here
    
          setTimeout(companymain.submit_func, 2000);
       }
    };    
    companymain.init();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an Event Calendar for my iPhone App. In a first
I want to create an event content type with one field Dates contains a
IN VB.NET (not c#)... I want to create an event than can be canceled
I want to create my own event - OnPositionChange . Event implementation of course
I have several Outlook Calendars. I want to be able to create one event
I want to create a new event for TFileListBox. I want to know when
I want to create an own event (which I'll fire via code) for a
I have a DataGridView for which I want to create an event handler for
I have a ListView in which i want to create an event when the
I want to create a custom event that will be triggered whenever a numeric

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.