html2canvas是未解析的函数或方法

Trying to take a screenshot from a webpage using html2canvas. The attached code is the function that I used. I arrive a 502 gateway error when run. The html2canvas function is an unresolved function or method. How to solve that?

<head>
    <title>PHP Test</title>
    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    <script src ="html2canvas.js" type="text/javascript"></script>
    <script>
        function capture(){
            const element = $("#logo"); //this is the html element whose screenshot we want to take
            html2canvas(element,{
                background:'#FFFFFF',
                onclone:function(canvas{
                    var imgData = canvas.toDataURL('image.png');
                    $.ajax({
                        url:'save.php', // save.php is the php script to save the captured screnshot to server
                        type:'post',
                        dataType : 'text',
                        data:{
                            base64data : imgData
                        }
                    })
                })
        })
        }
    </script>
</head>