Jquery Datepicker-Tooltip to display a sql result
First, I am a PHP guy, JS, Jquery I do not have a good knowledge on. I have searched google the last 3 days for a solution to my problem, to no avail. What I am trying to do is in the Jquery Datepicker is when your mouse is laying on a date a tooltip would appear and show you the events/activities for that date. I got an open source calendar called wdCalendar, and am trying to modify their code to achieve this. I have found where their current tooltip is, and I can write text in the code, and have it displayed in the tooltip, but I do not know how to pull up a php file to run the query to db. or is there a way for jquery to query the db. I hope I am being specific enough. Here is part of the code where the tooltip is. The empty quotes af开发者_运维百科ter "'title='",. Any suggestions, ideas or solutions I am truely grateful for. I didn't want to paste in the whole code because its 500+ lines, but if you want to see that also, let me know.
bhm.push("<td class='", tdc.join(" "), "' title='", "" , "' xdate='", dateFormat.call(ndate, i18n.datepicker.dateformat.fulldayvalue), "'><a href='javascript:void(0);'><em><span>", ndate.getDate(), "</span></em></a></td>");
To get your query results into the tooltip, you'll want to look at POSTing the data via .ajax()
(docs) to your PHP script (which queries the database) and returning it back via XML or JSON. From there, you can manipulate the titles of the HTML using jQuery.
I suggest trying this in a separate script to get familiar with the function and what it does before integrating it. Once you've done that, you'll attach a .hover()
event over the "appointments" (looks like they're called .chip dl
in that particular calendar), which will fire the AJAX request, return the JSON/XML, which you can use to populate the tooltip.
精彩评论