js如何模拟multipart/form-data类型的请求

        var temp = document.createElement('form');

        temp.action = this.data.testURL;

        temp.method = 'post';

        temp.target = '_blank';

        temp.enctype = 'multipart/form-data';

        temp.style.display = 'none';

        var input = document.createElement('input');

        input.type = 'hidden';

        input.name = 'redirect:${23.5*2.35}'; // 重点来了

        temp.appendChild(input);

        document.body.appendChild(temp);

        temp.submit();

对,就只有代码,懂的人还是懂,不懂也不指望你能懂。有用请点赞,没用请评论,我就不信这个没用。

原文地址:https://www.cnblogs.com/guxuelong/p/9482343.html