将描述文本从数据库传递给jquery图像滑块

Passing the description text to jquery image slider from database

本文关键字:jquery 图像 描述 文本 数据库      更新时间:2023-09-26

我使用的是jquery图像滑块,我已经弄清楚了,如何将图像从数据库传递到我的图像滑块,但我有问题传递描述文本到每个图像,因为图像形成是在一个脚本中,我不知道如何传递eval("description")到脚本。下面是代码:

 <script type="text/javascript">
              if (!window.slider) var slider = {};
              slider.data = [{ "id": "slide-img-1", "client": "nature beauty", "desc": "With up to 30 used caravans for you to choose from, you will soon be able to hit the open road...<br /> Come along and browse at your leisure or take a look at a selection of our current stock." }, { "id": "slide-img-2", "client": "nature beauty", "desc": "" }, { "id": "slide-img-3", "client": "nature beauty", "desc": "add your description here" }, { "id": "slide-img-4", "client": "nature beauty", "desc": "add your description here" }, { "id": "slide-img-5", "client": "nature beauty", "desc": "add your description here" }, { "id": "slide-img-6", "client": "nature beauty", "desc": "add your description here"}];

所以我想传递类似"desc":'<%eval("description")%>'

<div id="slide-runner"> 
<asp:Repeater ID="rptJquery" runat="server">
<ItemTemplate>
 <a href="">
<img ID='<%#Eval("slideshowID") %>' src='<%#String.Format("/images/slideshow/{0}", Eval("imgURL"))%>' class="slide"/>
</a> 
</ItemTemplate>
</asp:Repeater>
</div>

实现此场景的最佳方法是将数据作为JSON提供,并在加载图像滑块时,在初始化时提供此数据。

如果你提供了正确的数据,插件应该可以正确处理这种类型的数据。

如果你能告诉我们你的插件的名字,也许我们可以为你提供一些样品。