Can you use the echo function live in PHP?

Jill

New member
When I use the echo function in PHP, it only displays the data after the whole page has been parsed. Is there any way to output data live, meaning, as I call the echo function?
If I have to use AJAX for this, is there any easy way to do it?
 
PHP is server side. So once the page is retrieved from the server, its over.
In other words, once you see the page, you cannot have PHP simply come back and add something, like this:
<a href="link" onClick="<? phpFunction(); ?>">Some link</a>
It won't happen.
You have to send something back to the server via a page refresh or a AJAX method.
I suggest using jQuery (which you can learn at http://www.jquery.com ). It is a JavaScript derivative that make asynchronous scripting easier:
$.ajax( parameters );
Other than that, no you cannot.
Good Luck!
If you need further assistance/advice, feel free to contact me.
 
Back
Top