Created
February 16, 2023 15:02
-
-
Save bjoerntx/60a20e70b0b20d2e72879e903d73089e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSnippet(snippetName, snippetFormat) { | |
var serviceURL = "@Url.Action("Content", "Snippets")"; | |
console.log(snippetName); | |
$.ajax({ | |
type: "POST", | |
url: serviceURL, | |
data: { | |
name: snippetName, | |
format: snippetFormat | |
}, | |
success: successFunc, | |
error: errorFunc | |
}); | |
function successFunc(data, status) { | |
if (snippetFormat == "HTM") | |
document.querySelector('[tx-snippet-name="' + snippetName + '"] .snippet-preview').innerHTML = data + "..."; | |
else | |
TXTextControl.selection.load(TXTextControl.StreamType.InternalUnicodeFormat, data); | |
} | |
function errorFunc() { | |
$("#myToast .toast-body").text("Error! :-("); | |
$("#myToast").toast("show"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment