You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constform=document.getElementById("myForm");form.addEventListener("submit",function(e){e.preventDefault();constformData=newFormData(form);formData.append("access_key","YOUR_ACCESS_KEY_HERE");formData.append("subject","New Submission from Web3Forms");constfile=document.getElementById("attachment");constfilesize=file.files[0].size/1024;if(filesize>1000){alert("Please upload file less than 1 MB");return;}// Don't add `headers` or `content-type` in this fetch call// Since it contains attachments, the browser auto-adds them. fetch("https://api.web3forms.com/submit",{method: "POST",body: formData}).then(async(response)=>{letjson=awaitresponse.json();if(response.status==200){console.log(json.message);}else{console.log(response);}}).catch((error)=>{console.log(error);}).then(function(){form.reset();});});