chasethemetal Posted October 22, 2011 Share Posted October 22, 2011 Hey all! So I have a jquery counter, and it prints the count into a <div>. I know this doesn't work... But this is what I am trying to accomplish.... <?php $a = '<div id="count"></div>'; if ($a == '5') Do something ?> Now the counting is happening in Jquery because it's part of a media player, and I am trying to make the page do something once it's say 5 seconds into playing... This is what the line of jquery looks like that's creating the event...$("#count").text(parseInt(event.player.status.currentPercentAbsolute, 10) + "%"); Any help, pointers, or tips n tricks would be appreciated. Link to comment Share on other sites More sharing options...
Ingolme Posted October 22, 2011 Share Posted October 22, 2011 PHP does not do anything after the page has loaded. PHP runs on the server-side before the page has loaded, sends the data, and then the connection with the server is closed. If you want to execute PHP after the page has finished loading, you will need to learn AJAX. Link to comment Share on other sites More sharing options...
chasethemetal Posted October 22, 2011 Author Share Posted October 22, 2011 Ok thanks, I knew ajax was a route... One final question (this should be moved into the javascript section)... How could I assign the value of $("#count").text(parseInt(event.player.status.currentPercentAbsolute, 10) + "%"); to a var... This is what I am trying to accomplish... var a = $("#count").text(parseInt(event.player.status.currentPercentAbsolute, 10) + "%"); if (a == "2%") { do something }; Link to comment Share on other sites More sharing options...
chasethemetal Posted October 22, 2011 Author Share Posted October 22, 2011 figured it out.... var a = parseInt(event.player.status.currentPercentAbsolute, 10) + "%";if (a == "2%") { $("#count").html("WORKED");} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.