Hi there,
Quote:
|
JavaScript can do this. Can PHP?
|
To answer your question, no, you cannot dynammically load any files or modify codes with PHP after the page is loaded without reloading the page. PHP works on server-side whereas JavaScript works on client-side. That means once the page is loaded, PHP's task is done, and it doesn't do anything until the next page load. As for JavaScript, it cannot do anything before the page is loaded, but after that (even onLoad event cannot be triggerred before PHP says "I'm done.") because the JavaScript is to be "loaded" within your browser to do what it's programmed to, and PHP is the one that sends to the browser what should be loaded.
They are two different things, and it is important that you understand when to use PHP or JavaScript (Server-side/Client-side scripting), as they can be extremely powerful when combined in a complementing way.
My 2 cents.