Skip to content

Instantly share code, notes, and snippets.

@choonkeat
Created November 21, 2012 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save choonkeat/4122339 to your computer and use it in GitHub Desktop.
Save choonkeat/4122339 to your computer and use it in GitHub Desktop.
<p>
<strong>fetched</strong>
content
</p>
var MyClass = {
display: function() {
var ele = $('script:last');
$.get('content.html', function(data) {
ele.after(data);
});
}
}
<html>
<head></head>
<body>
<p>text before</p>
<script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="file.js" type="text/javascript"></script>
<script type="text/javascript">
MyClass.display();
</script>
<p>text after</p>
<script>
console.log('nothing here');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment