I can think up two approaches.
If your site is written with server-side language such as ASP.NET, you can implement it by the server-side scripts. After you get the data from database you create the jQuery slider HTML markup by the server side code, then render the page with the slider markup.
Suppose your page does not have the jQuery slider content when the page is launched. So you just add this markup in your page:
var sliderElm = document.getElementById(“mcts1”);
sliderElm.innerHTML = str;
- Then your page is retrieving data from database;
- Then your code will build the slider markup string based on the retrieved data;
- Then you call the addSlides function by inserting this script to your page:
addSlides(‘<div class="textSlide"><p>HTML Slide</p>Text text text</div><img src="slide-5.jpg" />’);
If your page is ASP.NET, above code will be like below in the code behind: