Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created July 19, 2019 15:24
Show Gist options
  • Save bjoerntx/0f224eee28c42581e882c904334ca6ac to your computer and use it in GitHub Desktop.
Save bjoerntx/0f224eee28c42581e882c904334ca6ac to your computer and use it in GitHub Desktop.
function saveUserDictionary() {
// get information about all user dictionaries
TXTextControl.Proofing.getUserDictionaryInfo(function (e) {
// loop through all dictionaries
e.forEach(function (item) {
// save the dictionary
TXTextControl.Proofing.saveUserDictionary(item.name, function (name, words) {
// create a new dictionary JSON object
var userDict = { language : item.language, name : name, words : words };
// call the Web API and pass the dictionary object
var serviceURL = "/api/Dictionary/SaveUserDictionary/";
$.ajax({
type: "POST",
url: serviceURL,
contentType: 'application/json',
dataType: "json",
data: JSON.stringify(userDict),
success: successFunc,
error: errorFunc
});
function successFunc(data, status) {
alert(data);
}
function errorFunc() {
console.log("error");
}
});
});
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment