Skip to content Skip to sidebar Skip to footer

Run A Php Function On Document Ready?

Is there anyway for me to run a certain php function when the document loads completely? I am trying to run a function which will mark a notification as read only when the document

Solution 1:

You can detect the "document-ready" event with a Javascript script and when that is triggered, perform an AJAX request to a PHP page that will run the script you need.

With jQuery it gets as simple as using ready() and ajax().

Solution 2:

Solution 3:

You must use AJAX for this, php is done server side so AJAX is the only way :)

Post a Comment for "Run A Php Function On Document Ready?"