简体   繁体   English

如何单击 HTML 按钮,就像用户正在单击一样

[英]How to do click the HTML button as if the user is clicking

I follow this URL to export Chart.js chart to image using download button and it works.我按照这个URL使用下载按钮将 Chart.js 图表导出到图像,它可以工作。 And here is the image result:这是图像结果: 在此处输入图像描述

If I click save button the image will download in my PC.如果我单击保存按钮,图像将下载到我的 PC 中。

My Question is:我的问题是:

Is there any way or a script so that the image can be downloaded to the server's own folder as if there is a user who clicks to the Save button?是否有任何方法或脚本可以将图像下载到服务器自己的文件夹中,就好像有用户单击“保存”按钮一样? For example once a day, the script will download the image by pressing the button and save the image to the server folder.例如每天一次,脚本将通过按下按钮下载图像并将图像保存到服务器文件夹。

Please give me the enlightment.请赐教。

The link you provided saves image using blob in saveas function.您提供的链接使用 blob 在 saveas function 中保存图像。 So what can you do is send the same blob to server using ajax call.因此,您可以使用 ajax 调用将相同的 blob 发送到服务器。 refer this link: How can javascript upload a blob?请参阅此链接: javascript 如何上传 blob?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM