How to send blob to php backend via ajax? [duplicate]

Hey I am new to javascript (asynchonous calls).
I would like to call the admin-ajax.php file which contains a function that needs an image/blob to insert in the DB.

So this is the ajax call I made:

jQuery.ajax({
    url:"//domain.com/wp-admin/admin-ajax.php",    //the page containing php script
    type: "POST",
    data: {action: "addimagetocart", image: blob},
    success:function(result){
        console.log(result);
    }
});

In the above code, the blob variable contains a blob (created by html2canvas) which could be saved as a .png file.

My questions:

  • How can I send the blob appropriately? At this moment, I receive the following errors: errors

  • I have tried to put the data in a FormData() object, but that does not work either.

  • Is it better to first convert the file into a .png or just send it as a blob and convert it in the php file?