I have a database, and I store the text there, its duration and the time when it should appear on the web page.
The php result is as follows:
{"text_content":"dgsgdsgds","text_duration":"15","start_time":"2015-09-28 23:11:15"},{"text_content":"dgsgdsgds","text_duration":"15","start_time":"2015-09-28 23:11:30"},{"text_content":"gdsgdsgds","text_duration":"15","start_time":"2015-10-01 14:00:00"}
I have a jquery script that retrieves data from a database and displays it on the screen:
var results =[]; var cursor = 0; function myFunction () { $.getJSON('list2.php', function(json) { results = json; cursor = 0;
and now I wanted to add a function that is displayed on the screen only for the date received from the database, like start_time , but I'm not sure that this can be done only on jquery, without any further action, access to the server code. I tried to add some if statements:
if(results[cursor].start_time == new Date()){
before you print it on the screen, but it didn’t help. could you help me? Thanks!
source share