Using ajax to recognize new html added to the folder structure and add it
to a list
I am trying to build a mini-application that has a global header and a
content div. This content div will have different html-based demos that
are loaded into it, depending on the html-base demo selected from the
header. I will include an outline of what I am trying to accomplish, as
well as the code that I am currently using for the content-swapping. Would
love some input on how to proceed.
One note--this must be able to be downloadable and ran locally, with no
server/sb setup.
+++++++++++++++++++++++++++++++++++++++++++++
First off, the outline: 1. FOLDER STRUCTURE Main Demos Demo #1 index.html
js css Demo #2 index.html js css
When the folder is empty:
When the folder has one folder added to it:
Demo #1 main > demos > Demo #1 > index.html
When the folder has more than one folder added to it:
Demo #1 Demo #2 main > demos > Demo #1 > index.html
When Demo #2 is selected from the dropdown:
Demo #1 Demo #2 main > demos > Demo #2 > index.html
+++++++++++++++++++++++++++++++++++++++++++++
Lastly, here is the code that I am currently using for the content swap.
Would love some insight. Thanks all!
jQuery.ajaxSetup ({
cache: false
});
var ajax_load = "";
//load() functions
var loadUrl = "ajax/load.html";
var loadUrl2 = "ajax/load2.html";
jQuery("#load_demo_01").click(function(){
jQuery("#result").html(ajax_load).load(loadUrl);
});
jQuery("#load_demo_02").click(function(){
jQuery("#result").html(ajax_load).load(loadUrl2);
});
No comments:
Post a Comment