Basic question on PHP + jQuery

suklee

Diamond Member
Oct 9, 1999
4,575
10
81
I want to display an article in a tooltip.. something like this: http://plugins.learningjquery.com/cluetip/demo/

The article is stored in a MySQL database. I've already got a basic PHP script that connects to the database and fetches the text, but not sure how to put it into the tooltip.

How would I accomplish this?
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,835
4,815
75
That depends where you want the tooltip to be. But most of those appear to load an external html page, e.g. http://plugins.learningjquery.com/cluetip/demo/ajax.htm

So you would want one .php page like that that displays your article text, possibly given one or more options to select the article. Then you put the code from the example page in your main page, replacing ajax*.htm with your php article loader, and possibly including options in the URL for your php article loader to select the article. Don't forget to include all the other javascript that's included at the top of that demo page (view the source.)

This all seems rather overworked to me. Are you sure title= in your html, with php filling in the text, won't do the job? (Newlines work on IE, but not Firefox.)

Or how about this possibly simpler tooltip: http://www.dynamicdrive.com/dy...ndex5/dhtmltooltip.htm
 

suklee

Diamond Member
Oct 9, 1999
4,575
10
81
That last link looks interesting. I think I can retrieve the text I need via PHP/MySQL and fill it into this?

*****="ddrivetip('JavaScriptKit.com JavaScript tutorials','yellow', 300)";