Jump to content

Ajax basics help


herghost

Recommended Posts

Hi all,

 

I want to display some blocks of text (testimonials) on my website, however I want them to auto fade in/out every 3 seconds or so without refreshing the page, is this possible with ajax? Where would I start?

 

I know I could do it in PHP by assigning each testominial to an array, then using the rand() function to display one, however the user would have to refresh the page everytime to view a new one

Link to comment
https://forums.phpfreaks.com/topic/194760-ajax-basics-help/
Share on other sites

Ajax is used to make http request back to a server via Javascript. You may or may not need to use it to retrieve your testimonials.

 

What I would do would be to have php load all your testimonials into a Javascript array when the page is created and then simply use Javascript to display these one after the other as you describe.

 

How many testimonials do you expect to display?

Link to comment
https://forums.phpfreaks.com/topic/194760-ajax-basics-help/#findComment-1024162
Share on other sites

herghost,

 

I'm not sure if this is precisely what you are looking for, but I saw a web page for a local restaurant that uses CSS to scroll pictures and text.  It doesn't fade in and out, but scrolls off the screen to display the next picture/text comment.  You might be interested -- if you view the page source you'll see the style sheets and looking at those will show you how to scroll:

 

http://www.yanagitx.com/

 

thorpe's idea sounds like a good one to.  So maybe if you can load them all into an array, you can use CSS to scroll through them.  If you have a tutorial on how to fade text in and out I would be interested to see that too!

Link to comment
https://forums.phpfreaks.com/topic/194760-ajax-basics-help/#findComment-1024391
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.