Как переписать отправку формы написанную на jQuery, используя fetch
function messagesFromBase() {
var subjectId = 2;
var lastName = 'text';
var firstName = 'text';
var thirdName = 'text';
var companyName = 'text';
var response = {};
$.ajax({
async: false,
type: "POST",
dataType: 'json',
charset: 'windows-1251',
url: "url-base",
data: {
subjectId: subjectId,
lastName: lastName,
firstName: firstName,
thirdName: thirdName,
companyName: companyName
},
success: function (resp) {
response = resp;
},
error: function (jqXHR, status, e) {
response = false;
},
});
return response;
}