}).then(function(data){ should be replace by Success: function(data)
Correct format of $ajax is below:
$.ajax({
type: "POST",
url: "xxxx",
data: xxxx,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
}
});