Reputation: 23
Hi I'm trying to pass a blob in data inside $.ajax
var blob = new Blob([content], { type: 'text/plain;charset=utf-8' });
$.ajax({
url: "myurl",
type: 'POST',
dataType: 'json',
data: {
'test': true,
'jsonFile': jsonFile,
'htmlFile': blob,
},
success: function(response) {
$('#msg').addClass('success');
}
});
return this error Uncaught (in promise) TypeError: Failed to execute 'arrayBuffer' on 'Blob': Illegal invocation
If i delete 'htmlFile': blob, works fine but i must pass a blob.
I read other thread i tried to use :
Do you have another idea?
Upvotes: 1
Views: 5145
Reputation: 11
Adding processData: false should resolve the issue, as this instruction stops jQuery from stringifying the data.
Upvotes: 1