Skip to content

Instantly share code, notes, and snippets.

@eclarrrk
Created September 1, 2020 17:48
Show Gist options
  • Save eclarrrk/a8c3df3ee42ce8d73a647503d425114f to your computer and use it in GitHub Desktop.
Save eclarrrk/a8c3df3ee42ce8d73a647503d425114f to your computer and use it in GitHub Desktop.
Display the contents of a text-based file on a page using jQuery
<p>Get the contents of <code>/wp-content/themes/webguard-ra-theme/sass/typography/_font-size.scss</code></p>
<pre class="has-small-font-size" id="myelement"></pre>
Using this code:
<pre class="has-small-font-size">
$( document ).ready(function() {
jQuery.get("/wp-content/themes/webguard-ra-theme/sass/typography/_font-size.scss", undefined, function(data) {
$('#myelement').append(data);
}, "html");
});</pre>
<script>
$( document ).ready(function() {
jQuery.get("/wp-content/themes/webguard-ra-theme/sass/typography/_font-size.scss", undefined, function(data) {
$('#myelement').append(data);
}, "html");
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment