I'm linking a javascript file on my page like this:
<script type="text/javascript" src="example.js"></script>
I have some HTML elements loaded normally and at the same time I'm loading HTML
content from another page like this with the same elements:
$( "#loaded_data-1" ).load( "Curriculum2.htm .half" , function( response, status, xhr ) {
// but this content won't access example.js so I need to call it like this below.
$.getScript( "example.js");
});
but this loaded content won't access example.js so I need to call through $.getScript( "example.js");
.
But this causes problems for the original normally loaded elements because for them it is loaded twice. How do I load example.js
once and apply to the all items on my site loaded the regular way and loaded with ajax
?