0

I'm guessing the title is kinda missleading but I'll just ask, let me explain the situation first:

I'm making an auctions website, and I have a countdown that shows the time that an auction has left, when the time is over I use ajax to call a php page that runs a script that updates a row in a mysql table and sends an Email telling the auction is over, now this is working fine, but I want it to work always. It should always check if an auction is over not when the user enters the page, but I don't know how to make this possible, the countdown is in jquery and I don't know how to be always checking if an auction is over to send the email and update the row.

Thank you, if you can help me, I didn't paste any code because I don't think it's necessary but if you need some let me know.

csl
  • 10,937
  • 5
  • 57
  • 89
Gustavo Sanchez
  • 725
  • 2
  • 6
  • 14

2 Answers2

1

For Updating and mailing for expire a auction on offline you should have try to Cron Jobs.

And For javascript solution you can try this

    var myVar = setInterval(function(){myTimer()},1000);

function myTimer()
{
var d = new Date();
var t = d.toLocaleTimeString();
document.getElementById("demo").innerHTML=t;
}

function myStopFunction()
{
clearInterval(myVar);
}
  • For more about interval in javascript you can check [this](http://www.w3schools.com/jsref/met_win_clearinterval.asp) –  Dec 10 '13 at 13:18
0

Try this:

var timer = setInterval('checkTimer()','Time Interval in milliseconds');
function checkTimer(){
   // code to check timer. If timer has ended clear the timer variable
}
Sandeep Nayak
  • 4,649
  • 1
  • 22
  • 33
  • Yes, again, the problem is not knowing when the timer ends, the problem is always checking in server, i know js is local, what i want is WITHOUT the page open..check if the times ended and sending and email – Gustavo Sanchez Dec 10 '13 at 13:01