标签:sync async javascrip def highlight 后台 rip alert 截屏
$("#example1").on("click",function(event){ if(confirm("是否上传")){ event.preventDefault(); html2canvas($(".jiBMsg"), { crossDomain: true, xhrFields: {withCredentials: true}, allowTaint: true, taintTest: false, background:"#fff", useCORS:true, onrendered: function(canvas) { // alert("111"); canvas.id = "mycanvas"; var dataUrl = canvas.toDataURL("image/jpeg"); // $("body").append(‘<img src="‘+dataUrl+‘">‘); // var pos = dataUrl.indexOf("4")+2; // dataUrl = dataUrl.substring(pos, dataUrl.length - pos);//去掉Base64:开头的标识字符 $.ajax({ type: "POST", url:url, async: false, data: { ‘data‘: dataUrl}, dataType: "text", success: function (data) { alert(data); }, error: function (err) { console.log(err); } }); } }) } })
标签:sync async javascrip def highlight 后台 rip alert 截屏
原文地址:https://www.cnblogs.com/dyy-dida/p/9480755.html