Я хочу отправить двоичные данные поста с помощью jquery ajax на серверную часть сервера, но я не могу добиться успеха с ним.
Данные об успешном посте, подобные этим
Я использую код, подобный этому
var newBoundary = createRandom(16)
var datax = '------WebKitFormBoundary'+ newBoundary +'\n'
datax += 'Content-Disposition: form-data; name="queryOptionsDTO"; filename="blob"\n'
datax += 'Content-Type: application/json\n\n'
datax += '{"queryPage":{"initialPage":0,"pageSize":15},"sortInfo":{"sortFields":[{"propertyName":"updateDate","ascending":false}]},"queryParameterDTOs":[{"queryParameterType":"SIMILARITY","propertyName":"kurum.gorunenAd","similarityStrategy":"START"},{"queryParameterType":"SIMILARITY","propertyName":"markaAdi","similarityStrategy":"START"},{"queryParameterType":"EQUALITY","propertyName":"barkodNumarasi","value":"'+ barkod +'"},{"queryParameterType":"SIMILARITY","propertyName":"piyasayaArzIsmi","similarityStrategy":"START"},{"queryParameterType":"SIMILARITY","propertyName":"urunCinsi","similarityStrategy":"START"},{"queryParameterType":"CONTEXT","propertyName":"menseiUlkeAdi","similarityStrategy":"START"},{"queryParameterType":"EQUALITY","propertyName":"ucYasAltiCocuklarIcinUretilmis"},{"queryParameterType":"EQUALITY","propertyName":"ithalImalBilgisi"}],"queryTotal":false}\n'
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("anonymousUtsToken",sessionStorage.getItem("anonymousUtsToken"));
xhrObj.setRequestHeader("preferredLocale","tr-TR");
xhrObj.setRequestHeader("Accept","application/json, text/plain, */*");
xhrObj.setRequestHeader("Content-Type","multipart/form-data; boundary=----WebKitFormBoundary"+ newBoundary);
},
url: '/UTS/vat/rest/vatKozmetik/kozmetikUrunSorgula',
type:"POST",
dataType:"binary",
data: datax,
processData:false,
contentType:false,
success:function (data, status, req) {
console.log( req);
},
error:function (req, status, error) {
console.log(req);
}
});
, но результат, как этот
Как я могу отправить данные как;queryOptionsDTO: (двоичный)