I've been told that using Divs instead of iframes is the way forward, so I'm using frames from my banner and main body. How do I load my index.html into my div?
did u try .load() of jquery. with server side technology you can do this easily.
Using jQuery:
jQuery('#myDiv').load('http://example.com/somefile.html');
Without jQuery:
var request = new XMLHttpRequest();
request.open('GET', 'http://example.com/somefile.html', true);
request.onreadystatechange = function (anEvent) {
if (request.readyState == 4) {
if(request.status == 200) {
document.getElementById("myDiv").innerHTML = request.responseText;
}
}
};
request.send(null);
Typically I use this approach to load small snippets of content dynamically. It's probably a bad idea to use a div if you're loading an extremely large amount of content (like an entire page). An iframe would be better for that scenario.
$(".divClassHere").load("url path here");
However, it sounds to me more like you're after a MasterPage
structure (if you've got ASP.NET) or file imports
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With