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 6235429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:39:59+00:00 2026-05-24T10:39:59+00:00

I need some help with a script I am developing. I have some advertisements.

  • 0

I need some help with a script I am developing. I have some advertisements.
When a user clicks on the advertisement, a new page will open up.

On that new page, there will be an div for status messages, and below that div a big iframe.

I want it like this:
1. In the status message box, it should say “Loading content of iFrame…” (Until the url of the iFrame has been fully loaded)
2. It should countdown from X seconds / loading bar.
3. When it hits zero, a form should run, and output data in the status div.

Can someone please help me obtain this? It should all be done with jQuery and without any reloads.

I HAVE THIS SO FAR:

   var countDownTimer = null;
    var seconds = <?php echo $exposure[$r['exposure']]; ?>;

    function setCountDownTimer(){
      if(countDownTimer)
        clearTimeout(countDownTimer);

      countDownTimer = setTimeout(updateCountdown, 1000);
    };

    function updateCountdown() {
          countDownTimer = null;
          seconds--;

          if (seconds > 0) {
             $("#countdown").text("You must view this advertisement for " + seconds + " seconds.");
             //$('#progressbar').progressbar({ value: Math.round((seconds/10)*100) });
             setCountDownTimer();
          } else {
             submitForm();
          }
     }

// on document load:
$(function() {

   $("#progressbar").progressbar({ value: 0 });

   // set "waiting" message:
   $("#loadingStatus").html("Waiting for your advertisements to load...");

   // on iframe load:

   $('#iFrame').load(function() {

       $("#loadingStatus").html($("#isDone").html());

       //Attached click event to the link inside iframe to restart the timer
       var iframe = $('#iFrame');
       iframe.contents().find("linkSelector").click(function(){  
         window.top.setCountDownTimer();  
       });

   });

   setCountDownTimer();
});



function submitForm() {
                $("#countdown").empty().html('<img src="..ify/dream/images/loading.gif" />');
                $.post(
                    'index.php?i=v&p=k&key=DSF79SADFHSA7D9FGSAD097FSAD7F9779ASDFGS9', 
                    $('form').serialize(),
                    function (data) {
                        proccessData(data);
                    }
                ); 

}  

function proccessData (data) {
            $('#statusF').hide().html('');

            if(data=='success'){
                $('form').fadeOut();
                $('#countdown').addClass('noti-success').html('Advertisement validated!').slideDown();
                redirect("?i=l");  
            }
            else {
                $('#countdown').addClass('noti-error').html(data).fadeIn();
            }
        }

The problem with the code above, is that when a user for example clicks in the iframe, the status message timer will mess up. So :/

  • 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-05-24T10:40:01+00:00Added an answer on May 24, 2026 at 10:40 am

    You need to use the jQuery.ajax method (or one of its derivatives). Using jQuery.ajax, you can send whatever data you need to the server to “run a form” (as you mentioned) and when you get html back, you can save it in a variable. You can then use your timer object to set the html of the div to the new content when the timeout expires.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help with a Bash script that will automatically add the git's
I need some help from the shell-script gurus out there. I have a .txt
I am new to all the anonymous features and need some help. I have
I am new to Perl and need some help. In Mysql I have a
I need some help with jQuery script again :-) Just trying to play with
Hi I need some help with the following scenario in php. I have a
I'm working with jQuery for the first time and need some help. I have
I'm looking for suggestions on new development system from some programmers that have more
I need some help in converting my script from using mysql to mysqli I
I need some help with creating a regex for my php script. Basically, I

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.