Last active
July 8, 2022 04:02
-
-
Save asharma327/91b2e339161b90bb9ee38fb0237393c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Save Web Form Data to Postgres - Contact Form</title> | |
<script | |
src="https://code.jquery.com/jquery-3.4.1.js" | |
integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" | |
crossorigin="anonymous"></script> | |
<script> | |
function SubForm (){ | |
$.ajax({ | |
url:'https://api.apispreadsheets.com/data/jMGwn06FaKODhaKy/', | |
type:'post', | |
headers:{ | |
accessKey: "3f7608848c6cb3c4fbf02649c59b7ba5", | |
secretKey: "255bb6cfdfca9f0cac3c7df9ebc74b3c" | |
}, | |
data:$("#myForm").serializeArray(), | |
success: function(){ | |
alert("Form Data Submitted :)") | |
}, | |
error: function(e){ | |
alert("There was an error :(") | |
} | |
}); | |
} | |
</script> | |
</head> | |
<body> | |
<form id="myForm"> | |
<label>Full Name</label> | |
<br/> | |
<input name="name" /> | |
<br/> | |
<label>Email</label> | |
<br/> | |
<input name="email" /> | |
<br/> | |
<label>Age</label> | |
<br/> | |
<input type="radio" id="age" name="age" value="18-35" /> 18-35<br/> | |
<input type="radio" id="age" name="age" value="35+" /> 35+<br/> | |
<br/> | |
<label>Message</label> | |
<br/> | |
<textarea name="message"> | |
</textarea> | |
<br/> | |
<br/> | |
</form> | |
<button onclick="SubForm()">Submit</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment