只需要一点帮助,将下面的JavaScript连接到HTML表单,这样我就可以POST到下面的API。
var axios = require('axios');
var data = JSON.stringify({"email":"someone@example.com","first_name":"Phill","last_name":"Chill"});
var config = {
method: 'post',
url: 'https://api.zoom.us/v2/webinars/{webinarId}/registrants',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer {token}',
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
非常感谢
如果你想用收到的post数据填充HTML表单,你需要将输入与带有id的数据链接起来,比如:
<input id="first-name">
JS要签名的值:
document.getElementById("name").value = response.data.first_name;
或者如果您使用jQuery
$('#first-name').val(response.data.first_name);