Here goes my first post here, please be kind with your comments as I need detailed guidance here.
Background, second-year college student, 1-year python trained. Only started learning javascript two weeks ago. No prior experience in coding before college.
I have created a webpage that first streams the webcam, then at the click of a button, takes a snapshot and displays it on the webpage through the usage of a canvas.
What I want to do: send that canvas image to a server using a separate button.
What I have done:
Used navigator.getUserMedia() for webcam streaming.
Converted the canvas image into base64 using canvas.toDataURL().
Tried googling online to find tutorials to do "POST" requests but I am unsure how to work around it, in short, I do not understand how to write a code that sends data to a server.
- Tried to use jQuery, but still I am really quite confused over here.
 
$(document).ready(function(){
    $("#testbutton").click(function(){
        $.get("http://localhost:8080",
        url,
        function(){
            alert("OK");
        });
    });
});
- Do I need to convert to base64 before sending?
 - How do I send?
 - I read on MDN that navigator.getUserMedia is deprecated, how do I use MediaDevices.getUserMedia()?
 
Some of my code snippets.
if(navigator.getUserMedia) { // Standard
        navigator.getUserMedia(videoObj, function(stream) {
            video.src = stream;
            video.play();
        }, errBack);
    } else if(navigator.webkitGetUserMedia) { // WebKit-prefixed
        navigator.webkitGetUserMedia(videoObj, function(stream){
            video.src = window.webkitURL.createObjectURL(stream);
            video.play();
        }, errBack);
    }
    else if(navigator.mozGetUserMedia) { // Firefox-prefixed
        navigator.mozGetUserMedia(videoObj, function(stream){
            video.src = window.URL.createObjectURL(stream);
            video.play();
        }, errBack);
    }
Tutorials followed: