have a jquery slider (FlexSlider) set up on a website. The slider displays content from an unordered list. It would be a lot more convenient for me if instead of listing the images names on the same page as the slider is located, I could import ul class "slides" from another file via jquery. Can anyone tell me what command I could use in my main slider file to import the ul from another file? Thanks for the help.
Asked
Active
Viewed 440 times
1 Answers
1
To load HTML from another file on your domain into your site you can use jQuery's .load() function.
$('#elementOnYourSite').load('path/to/file.html');
You can even load a specific element from the other file into an element on your site:
$('#elementOnYourSite').load('path/to/anotherFile.html #elementInOtherFile');

adeneo
- 312,895
- 29
- 395
- 388
-
For future searchers, when implementing this solution, I found that the content was cached, which wasn't ideal for me. The solution for that issue was here: http://stackoverflow.com/a/2158535/1063287 – user1063287 Nov 30 '14 at 21:44