imageURL = wp.media.attachment(imageID);
imageURL.fetch({});
fetch(ajaxSettings.ajaxurl, {
method: 'POST',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache',
},
body: params
}).then(response => {
return response.json();
})
.then(response => {
// read data here
console.log(response);
}).catch(err => {
console.log(err);
});