I'm using PHP, HTML & jQuery. Lets say this is my original working "index.html"
<script type="text/javascript" src="jquery.js"></script>
<script>
var p1 = "This is part 1";
var p2 = "This is part 2";
$(document).ready(function(){
alert(p1);
$('#content').html(p2);
});
</script>
<div id="content"></div>
<div id="content2">Hello</div>
I want to break the code into "index.html" & "otherFile.notSureWhatExt" but they are working as if in the same file.
index.html:
<script type="text/javascript" src="jquery.js"></script>
<script type="notSureWhatType" src="otherFile.notSureWhatExt"></script>
<script>
var p1 = "This is part 1";
$(document).ready(function(){
alert(p1);
});
</script>
<div id="content"></div>
otherFile.notSureWhatExt:
<script>
var p2 = "This is part 2";
$(document).ready(function(){
$('#content').html(p2);
});
</script>
<div id="content2">Hello</div>
Using jsp, I can simply use <%@ include file="otherFile.anyCustomExtAlsoWorks"%>. But here I don't now. What I want is when calling index.html, I can see message box "This is part 1" and 2 div at the bottom which is "This is part 2" & "Hello".