Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created October 10, 2023 12: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 bjoerntx/347f4c02dcfb7f0890baef422bae0e9b to your computer and use it in GitHub Desktop.
Save bjoerntx/347f4c02dcfb7f0890baef422bae0e9b to your computer and use it in GitHub Desktop.
// ajax call to get the svg with glyphs
$.ajax({
url: '@Url.Action("GetSVG", "Home")',
type: 'GET',
dataType: 'json',
success: function (data) {
console.log(atob(data[0]));
// for each element in data array
$.each(data, function (index, value) {
// create img element
var img = document.createElement('img');
img.className = 'svgImage';
img.src = 'data:image/svg+xml;base64,' + value;
img.width = 200;
// append to container
$('#imageContainer').append(img);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment