Jump to content

Capturing Jquery Counter In Php


chasethemetal

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...