Created
July 19, 2019 15:24
-
-
Save bjoerntx/0f224eee28c42581e882c904334ca6ac 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 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