进行ajax调用并在qtip中显示内容
我正在为下拉列表编写代码。下拉列表是根据数据库中的数据填充的。因此,我进行了 2 个 ajax 调用,一个是在 onmouseover 事件上填充下拉列表的内容,另一个是在选择特定选项时进行 ajax 调用以将相关内容显示在屏幕上。
现在我想进行另一个 ajax 调用来获取将鼠标悬停在特定选项上时可以填充的内容。 ajax调用得到的内容可以显示在小对话框中。为了实现这一点,我安装了 qtip 库。
问题
我不明白如何进行ajax调用。哪个更适合实现这一目标?我知道 qtip 是在页面加载时加载的。但因为我想进行 ajax 调用来获取将鼠标悬停在选项上时显示的消息内容。有什么建议吗?
我还在某处读到,一次不能进行超过 2 个 ajax 调用。
** 3次ajax调用的内容不同。我为每个文件都有单独的 JSP 文件。
I am writing code for a dropdown list. The dropdown list is being populated from the data from the database. So I am making 2 ajax calls one is on event onmouseover to populate the contents of dropdown list and the other on selection of specific option making ajax call to bring related contents on the screen.
Now I want to make another ajax call to get the contents which can be populated on hovering over the specific option. The contents got from ajax call can be displayed in the small dialog box. For achieving this I have installed the qtip libraries.
Problem
I am not getting how the ajax call be made. Which even will be appropriate for achieving this? I know the qtip is loaded onload of the page. But since I want to make ajax call to get the contents of the message to be shown on hovering over the option. Any suggestions?
I have also read somewhere that you can't make more than 2 ajax calls at a time.
** The contents for the 3 ajax calls are different. And I have separate JSP files for each of them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以这样做,
这将进行一次 AJAX 调用,填充 select 并初始化 Niceforms 和 qtip。
You could do this
That would make one AJAX call, populate the select and init niceforms and qtip.
当您进行 AJAX 调用来获取下拉列表内容时,您还可以返回要为每个列表项显示的描述,并将它们影响到相应的 qtip。
qtip 将在鼠标悬停时显示,并显示您在填充下拉列表时设置的说明。
When you make your AJAX call to get the dropdown list content, you can also return the descriptions you want to display for each list item and affect them to the corresponding qtip.
The qtip will show onmouseover, and with the description you have set when populating your dropdown list.