admin管理员组文章数量:1292148
I have a test.php file and this file contains some PHP code, HTML elements and some internal JavaScript and some external JavaScript include.
I want to know which is first to load or execute.
PHP or HTML or JavaScript? I want to know execution order.
Your answers are greatly appreciated and very helpful to me and others also.
I have a test.php file and this file contains some PHP code, HTML elements and some internal JavaScript and some external JavaScript include.
I want to know which is first to load or execute.
PHP or HTML or JavaScript? I want to know execution order.
Your answers are greatly appreciated and very helpful to me and others also.
Share Improve this question edited Jun 8, 2016 at 11:49 GottZ 4,9471 gold badge37 silver badges47 bronze badges asked Jun 4, 2012 at 6:55 prakashprakash 1842 silver badges10 bronze badges 02 Answers
Reset to default 16Pragmatically speaking, this is the typical order:
- PHP runs first and constructs the page.
- The browser loads the resulting HTML (any JavaScript found gets executed immediately)
- Any JavaScript that was tied to the DOM ready or load event gets executed once the whole HTML is read and all objects are loaded respectively.
PHP will execute first, then HTML and finally javascript.
- You send request to server, server executes your script
- Then returns rendered html to browser, browser parses HTML(inline javascript executed)
- Finally executes external included javascript files, one by one in order they are included.
本文标签: phpHTMLJavascript execution orderStack Overflow
版权声明:本文标题:PHP, HTML, Javascript execution order - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738664996a2105647.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论