macek/jquery-serialize-object

Expand README.md to include instructions on usage

zentuit opened this issue · 3 comments

The README.md looks great as far as what it is, the API, etc. However for a brand new jQuery user, there is no information or instructions on how to use it in their web page.

https://github.com/macek/jquery-serialize-object#api

The API section does actually cover using this helper on your web page.

.serializeObject — serializes the selected form into a JavaScript object

$('form#contact').serializeObject();
//=> {user: {email: "jsmith@example.com", pets: ["cat", "dog"]}}

This gives you an object you can manipulate in your js code, that is generated from the HTML form on your web page.

.serializeJSON — serializes the selected form into [JSON][json]

$('form#contact').serializeJSON();
//=> '{"user":{"email":"jsmith@example.com","pets":["cat","dog"]}}'

This may look identical, but is actually a sting that would be more suitable for sending to a backend server for processing.

@Rockstar04 thanks for chiming in here.

@zentuit, does the API documentation help you understand how to use it better? Or were you looking for some more specific support?

To get this plugin working on your site, all you need to do is include it after your jQuery

<script src="jquery.min.js"></script>
<script src="jquery.serialize-object.compiled.js"></script>

I've added an Installation section to the README.

Please see the API section for usage examples.