我想在JavaScript中使用XMLHttpRequest发送一些数据.
假设我在HTML中有以下表单:
<form name="inputform" action="somewhere" method="post">
<input type="hidden" value="person" name="user">
<input type="hidden" value="password" name="pwd">
<input type="hidden" value="place" name="organization">
<input type="hidden" value="key" name="requiredkey">
</form>
Run Code Online (Sandbox Code Playgroud)
如何在JavaScript中使用XMLHttpRequest编写等效代码?
我正在尝试ES6,我使用gulp构建和babel转换为ES5.输出不在节点中运行,只是从带有标记的.htm文件链接.我想我需要补充一下
<script src='require.js'></script>
Run Code Online (Sandbox Code Playgroud)
或类似的东西.
我试图导入/导出.
////////////////scripts.js
import {Circle} from 'shapes';
c = new Circle(4);
console.log(c.area());
/////////////////shapes.js
export class Circle {
circle(radius) {
this.radius = radius;
}
area() {
return this.radius * this.radius * Math.PI;
}
}
Run Code Online (Sandbox Code Playgroud)
错误是
Uncaught ReferenceError: require is not defined
Run Code Online (Sandbox Code Playgroud)
参考这个(在gulp之后的.pipe(babel())之后)
var _shapes = require('shapes');
Run Code Online (Sandbox Code Playgroud)