Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i wanna compare two variable that is contained time value but one is is produced when page created and another is got of database and i wanna create a timer that start when crate page and show alert when receive to database time .
i had to do it by jquery .what solution you suggest for this tasks
1) how can i obtain database time value that fetch in code behind by jquery
2) how can i create timer that start when page is created
thanks a lot
Posted
Updated 12-Apr-12 23:45pm
v2
Comments
ZurdoDev 13-Apr-12 8:24am    
Please explain more clearly. I can't follow what you are trying to do.
aminkourosh 13-Apr-12 9:35am    
i wanna snippet code that can compare a value contains datetime and saved in hidden field and obtain of database beforehand with the time of page is created.then timer start and when two values where equal alert me.
i think that i need a jquery function for clock like this
window.setInterval(function() {$("#example").timer();}, 1000);
but i need more complete code

1 solution

I would do something like this:

1. Get the datetime from database and write to hidden field (eg inside a DIV tag with id 'xyz' and style = hidden). Make sure you write it with a format you can handle.
2. In the end a web page is nothing more then an text file written starting at the html tag and ending with /html tag. Right before the /html tag, add a call to the function that will calculate the difference.
3. In that function you define a new end date and read out the hidden start date. With those two values you can calculate the difference.

Hope this helps.
 
Share this answer
 
Comments
aminkourosh 13-Apr-12 9:15am    
do you help me more about the function that you explain
V. 13-Apr-12 9:20am    
If you have specific problems, yes. I will not however, write it for you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900