views:

62

answers:

4

Hey,

I've been researching all over for this, basically I have a table that displays "eco'texthere';' after posting the data.

How would I make the text fade in e.g. :

Table ---> User Send data using submit button ---> displays back message "rotating data" ---> Now text fades in saying "sucessfully sent". (Mostly using echo in PHP).

Will I need a timeout function and Jquery for this?

A: 

Yes, since this is a client-side effect I recommend you look into jQuery to do this, for example by using fadeIn

Justin Ethier
How would I combile "echo" with Jquery fade in and dispear?
Raymond
+1  A: 

Yes - PHP is done executing by the time you're able to show the response to the user. You would want to take that PHP response (via AJAX), put it in a DOM element (like a div), and then animate that DOM element with jQuery once the AJAX call is complete.

mway
actually it depends on the server you are using. if you are using IIS then php shurely is done working when you see anything because it has outputbuffering activated by default. if you have an appache then you just do a flush() in your code and any output you did with echo; will be sent to the client regardless of the actual processing state of the php.
ITroubs
Yes, that's true, I was speaking in generalities. Regardless, there is no 'comet/push' state of being in this particular example - trying to use PHP to animate something like this would obviously be fruitless. ;)
mway
How would I combile "echo" with Jquery fade in and dispear?
Raymond
+1  A: 

you can use Mootools instead of jQuery:

http://mootools.net/docs/core/Fx/Fx.Tween

mhambra
How would I combile "echo" with Jquery fade in and dispear?
Raymond
+1  A: 

You'll want to import a jQuery library like the fellows above recommended... Then you have something like:

$.get("yourphpscript.php",function(response){
    $("#somediv").html(response).fadeIn('slow');
});

The div #somediv should start out with display:none;.

akellehe