如何显示信息通过Ajax调用的工具提示返回 [英] How to display information returned by ajax call in a tooltip

查看:86
本文介绍了如何显示信息通过Ajax调用的工具提示返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了它返回从数据库所需的信息的JSP文件。我也写code这将使得AJAX调用该JSP文件检索信息。但我没有得到任何好处或免费工具提示​​库知道如何把这些信息为工具提示。请提示提示在JavaScript中的优秀且免费的图书馆(我不是在jQuery的好,我知道它的厉害,但我需要学习和改变我的整个code)。

I have created a JSP file which returns the information required from database. I have also written code which will make ajax call to this jsp file to retrieve the information. But I am not getting any good or free Tooltip libraries to know how to put this information into tooltip. Kindly suggest good and free libraries of tooltip in javascript( I am not good in jquery I know its powerful but I need to learn and change my whole code).

问题:我需要表现出将鼠标上的列表视图的不同选择这个工具提示内容。 (列表视图的每个选项都会有不同的infrormation)在每个选项移动鼠标应该发送Ajax调用JSP页面,并获得预期回调到工具提示)我现在的JavaScript的code键使Ajax调用,并得到从JSP文件内容的唯一问题是tootip使用库,以及如何使用它的列表视图的每个选项。请建议。

Problem: I need to show this tool tip contents on hovering the mouse on different options of listview. (each option of listview will have different infrormation) On moving mouse on each option should send an ajax call to the JSP page and get the intended calls back into the tooltip) I now the code of javascript to make ajax calls and get contents from JSP file the only problem is which tootip libraries to use and how to use it for each option of listview. Kindly suggest.

推荐答案

qTIP 将这样的伎俩。获取库。其配置为您需要的标签。其余的可以遵循这样的:

qTIP will do the trick. Get the library. Configure it for the tags that you need. The rest could follow like this:

  1. 获取Ajax响应
  2. 使用JavaScript来修改title属性。类似于

的document.getElementById(id)的.setAttribute('标题','Ajax响应这里');

该库将完成剩下的给你。

The library would do the rest for you.

要规避AJAX的问题,叫你可以使用这个检查:

To circumvent the problem of the AJAX call you can use this check:

//on mouseover call for an AJAX function and check this
if(!document.getElemenyById(id).getAttribute){
    //the title is not set, use Ajax to retrive it an set it
    tooltip.init(); //this is crucial for the tooltip to work
}

编辑:里面的库搜索 VAR qTipTag =一,标签,输入; 键,将其更改为 VAR qTipTag =里,一,标签,输入; 。这将启动提示引擎为你想要的标签。

Inside the library search for var qTipTag = "a,label,input"; and change it to var qTipTag = "li,a,label,input";. This would start the tooltip engine for the tags you want.

你可以看到它在这里工作 http://jsfiddle.net/DarkThrone/gu6T2/5/

you can see it working here http://jsfiddle.net/DarkThrone/gu6T2/5/

这篇关于如何显示信息通过Ajax调用的工具提示返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆