sharepoint enterprise – Create cascading drop-down with JavaScript and DOM manipulation, but render incorrectly

I have a simple list with two dropdowns. I use JavaScript to create a cascading dropdown feature. A reference to my JavaScript file is placed in a content editor web part of the list form and works fine. The problem is, when I click "Submit", incorrect values ​​are entered in the list. Not sure why. Please help

Here is the setup. I have two lists. A "service" list and a "service category" list. A 1-many relationship. When a value is selected in the Service list, that value is used to filter the Service Categories list.

Here's a picture for more clarity:
Enter the image description here

$ (Document) .ready (function () {
// alert (document.querySelector ("[title='Service']"));
cascadeDropDown ();
});


Function cascadeDropDown () {
var service = document.querySelector ("[title='Service']");

service.onchange = function () {
var serviceSelection = service.options[service.selectedIndex].Value;
console.log ("Service:" + serviceSelection);
getServiceSubValue (serviceSelection);
}
}

Function getServiceSubValue (selectedValue) {
// alert (selectedValue)

var category = document.querySelector ("[title='Category']");
clearCategoryOption ();
var endPointUrl = _spPageContextInfo.webAbsoluteUrl + "/ _api / web / lists / getByTitle (& # 39; Service% 20Categories & # 39;) / items? $ filter = Service eq & # 39;" + selectedValue + "" ";
var headers = {"accept": "application / json; odata = verbose"};

jQuery.ajax ({
URL: endPointUrl,
Type: & # 39; GET & # 39 ;,
Headers: Headers,
Success: Function (Data) {
//console.log(data.d.results);
//Alert(data.d.Ergebnisse);
for (var i = 1; i <data.d.results.length; i ++) {
Console.log (Data.d.results[i].Title);
console.log (i);
var opt = document.createElement ("option");
opt.value = i;
opt.text = data.d.results[i].Title;
category.add (opt, null);
}
}
})
}

Function clearCategoryOption () {
var category = document.querySelector (" 
  [title='Category']") .Options.Length = 0;
}