Skip to content

Instantly share code, notes, and snippets.

@clonn
Created February 22, 2012 18:51
Show Gist options
  • Save clonn/1886620 to your computer and use it in GitHub Desktop.
Save clonn/1886620 to your computer and use it in GitHub Desktop.
form serialize for jQuery and YUI example.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="">
<meta name="created" content="2012-02-23">
<meta name="modified" content="Thu Feb 23 02:44:31 2012">
<title> Form serialize - Prototype by Caesar Chi</title>
<script type="text/javascript" src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<style type="text/css">
</style>
</head>
<body>
<form method="POST" id="sample-form">
<label for="firstname">First name:</label><input type="text" id="firstname" name="firstname" value="Caesar" >
<label for="lastname">Last name:</label> <input type="text" id="lastname" name="lastname" value="Chi">
</form>
<script>
YUI().use('io-form', function (Y) {
alert("YUI form serialize: " +
Y.io._serialize({
id: "sample-form"
})
);
});
(function () {
alert("jQuery form serialize: " + $("#sample-form").serialize());
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment