I am trying to POST raw data of 512 bytes to an Arduino with an Ethernet shield from Internet Explorer 8. If you don't already know, an Arduino is a very small microcontroller with a VERY limited amount of RAM (SRAM), therefore neither Base64 nor URL encoding the data is an option or the stack will overflow.
I need to send this data very quickly in very short intervals (somewhere between 100ms and 250ms). No more, no less than 512 bytes of raw, un-encoded, unprocessed, binary data from IE8 (IE8 because IE9+ is not available for Windows XP) inside one POST request body.
This code works in FireFox
function PostDMXData(evt)
{
var buff=new ArrayBuffer(512);
var bytesArray=new Uint8Array(buff);
for(var i=0;i<512;i++)
{
bytesArray[i]=DMXData[i];
}
jQuery.ajax({
url: "dmxdata.php",
type: "POST",
async: true,
error: function(a,b,c){alert(c);},
complete: function(a,b)
{
if(evt){evt();}
},
contentType: "application/octet-stream",
data: bytesArray,
processData: false
});
delete buff;
delete bytesArray;
}
But not in IE8. alert(c)
inside the error function displays "Error: The parameter is incorrect." Using a non-minimized jQuery I found that it's an exception being generated by the XMLHttpRequest object on .send(...)
itself.
I've tried using 2 different polyfills/shims for the Uint8Array data type that I found referenced here on StackOverflow for a number of related questions but it seems none of these are compatible.
Should I continue looking for another Uint8Array shim, give up on Ajax, or should I try something else with Ajax/jQuery?