Wall3-8e
Wall3-8e

Reputation: 23

Blob and Ajax issue TypeError: Failed to execute 'arrayBuffer' on 'Blob': Illegal invocation

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

Answers (1)

Prakash Rastapur
Prakash Rastapur

Reputation: 11

Adding processData: false should resolve the issue, as this instruction stops jQuery from stringifying the data.

Upvotes: 1

Related Questions