admin管理员组文章数量:1415119
Is there anyway for me to run a certain php function when the document loads pletely? I am trying to run a function which will mark a notification as read only when the document has been loaded pletely. What can I do?
Is there anyway for me to run a certain php function when the document loads pletely? I am trying to run a function which will mark a notification as read only when the document has been loaded pletely. What can I do?
Share Improve this question asked Oct 6, 2013 at 12:51 christianleroychristianleroy 1,1045 gold badges25 silver badges39 bronze badges 1-
Reconsider your logic or just use
ajax
or load anIMG
inJS
onLoad
. PHP is long finished building your page's HTML when your document ready gets triggered. You need to callback to achieve the result you seek. – CodeAngry Commented Oct 6, 2013 at 12:56
3 Answers
Reset to default 7You 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().
yes you can do an ajax call to that php file on document ready.
You must use AJAX for this, php is done server side so AJAX is the only way :)
本文标签: javascriptRun a PHP function on document readyStack Overflow
版权声明:本文标题:javascript - Run a PHP function on document ready? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745199084a2647283.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论