Last active
September 2, 2019 06:25
-
-
Save LeanSeverino1022/264811e6a4987e49acc5c19b2ad827a6 to your computer and use it in GitHub Desktop.
[Serialize form data with jquery] from JS Bin// source http://jsbin.com/zofepa
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> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<form action=""> | |
<label for="name">Name:</label> | |
<input type="text" name="name" value="Puyih"> | |
<br> | |
<label for="age">Age:</label> | |
<input type="text" name="age"> | |
<script src="https://code.jquery.com/jquery-3.1.0.js"></script> | |
<input type="submit"> | |
<div class="results">Results:</div> | |
</form> | |
<script id="jsbin-javascript"> | |
$('form').submit(function(event) { | |
event.preventDefault(); | |
var form = $('form').serialize(); | |
console.log(form); | |
$('.results').append(form); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">$('form').submit(function(event) { | |
event.preventDefault(); | |
var form = $('form').serialize(); | |
console.log(form); | |
$('.results').append(form); | |
});</script></body> | |
</html> |
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
$('form').submit(function(event) { | |
event.preventDefault(); | |
var form = $('form').serialize(); | |
console.log(form); | |
$('.results').append(form); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment