将表单数据获取到javascript webhook

时间:2020-07-25 13:52:39

标签: javascript html http

    <script>
function sendWebhook() {

    var http = new XMLHttpRequest();
    var url = 'here is the link of the webhook';
    var content = {
  "content": " the form data will go here "
};
    http.open('POST', url, true);


    http.setRequestHeader('Content-type', 'application/json');

    http.onreadystatechange = function() {
        if(http.readyState == 4 && http.status == 200) {
            alert(http.responseText);
        }
    }
    http.send(JSON.stringify(content));
}
</script>

<input id="plswork" type="text" value="clickeame" onclick="webhookdata()" />
<input id="contact-submit" type="button" class="btn btn-transparent" value="clickeame" onclick="sendWebhook()" />

这是我的代码,我希望

0 个答案:

没有答案