<!--index.html--> <div class="page" icon="images/1.gif"> <h1>blah blah</h1> </div> <div class="page" id="page2" icon="images/2.gif" source="pages/page2.html"></div> <div class="page" icon="images/3.gif"> <h1>blah blah 3</h1> </div>
<!-- page2.html --> <h1> blah blah 9000</h1>
and the relevant javascript
$('.page').each(function(i, obj) {
if(this.hasAttribute("source")){
$.get($(this).attr('source'), function(data){
$(this).append(data);
$(this).removeAttr("source");
});
}
}
So, as you can probably see, the expectation is that we can inject html from an external html file into a specified div in the main one. However, this isn't working - the div doesn't update. Can anyone see what's going on?
You can see the code thus far at my github page scarf.
This post has been edited by atraub: 14 March 2015 - 11:46 AM

New Topic/Question
Reply



MultiQuote


|