Jquery Datepicker-Tooltip 显示sql结果
首先,我是一个PHP人,JS、Jquery我不太了解。过去三天我在谷歌上搜索了我的问题的解决方案,但没有成功。 我想做的是在 Jquery Datepicker 中,当您的鼠标放在某个日期上时,会出现一个工具提示,并向您显示该日期的事件/活动。我有一个名为 wdCalendar 的开源日历,并且正在尝试修改他们的代码来实现此目的。我找到了他们当前的工具提示在哪里,我可以在代码中编写文本,并将其显示在工具提示中,但我不知道如何提取 php 文件来运行对 db 的查询。或者有没有办法让 jquery 查询数据库。我希望我说得足够具体。这是工具提示所在的代码的一部分。 "'title='", 后面的空引号。我非常感谢任何建议、想法或解决方案。我不想粘贴整个代码,因为它有 500 多行,但如果您也想看看,请告诉我。
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>");
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 after "'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>");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要将查询结果放入工具提示中,您需要查看通过
.ajax()
POSTing 数据 (docs) 到您的 PHP 脚本(查询数据库)并通过 XML 或 JSON 返回。从那里,您可以使用 jQuery 操作 HTML 的标题。我建议在集成之前在单独的脚本中尝试此操作,以熟悉该函数及其功能。完成此操作后,您将在“约会”上附加一个
.hover()
事件(看起来它们在该特定日历中被称为.chip dl
),这将触发 AJAX 请求,返回 JSON/XML,您可以使用它来填充工具提示。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.