I changed your javascript, and tested this, please try if it work with you :
function create_XHR(){
var XHR = null;
if (window.XMLHttpRequest){
XHR = new XMLHttpRequest();
}
else if(window.ActiveXObject){
try {
XHR = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
XHR = new ActiveXObject("Microsoft.XMLHTTP");
}
}
else {
alert("Your navigator is old to run objets XMLHTTPRequest...");
XHR = false;
}
return XHR;
}
function ajax_post(page, data) {
var XHR = create_XHR();
XHR.open("POST", page, true);
XHR.onreadystatechange = function() {
if (XHR.readyState === 4 && (XHR.status === 200 || XHR.status === 0)) {
console.log("Success Transaction");
}
};
XHR.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
XHR.send(data);
}
//Running the code :
//==================
var dataURL = me.video.getScreenCanvas().toDataURL();
ajax_post("http://www.mywebpage.com/image_upload.php", {"imgdata":dataURL});
Modify the cors http : in the server PHP add this in first of your page "image_upload.php":
//Part added by ilyas :
if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400'); // cache for 1 day
}
//End of part.