so far i have a simple script to include few html files on all pages. What i would like to achieve is to include specific file based on the folder in the url that visitor is currently on and define those folder names, for example:
- If /page-1/index-1.html (include demo-1.html)
- If /page-1/index-2.html (include demo-1.html)
- If /random-page/test.html (include demo-1.html)
- If /page-2/index-1.html (include demo-2.html)
- If /page-2/index-2.html (include demo-2.html)
- If /another-folder/test.html (include demo-2.html)
- ... and so on
Currently i include both demo-1.html and demo-2.html on all pages, but this is not working for me as the content inside those two files is different per folder. The script i use:
$.ajax({
url: "../include/demo-1.html",
success: function (data) { $('body').append(data); },
dataType: 'html'
});
Any help appricieted, thanks :)