Knowledge Walls
Venkatesan
Hyderabad, Andhra Pradesh, India
Passcode:
.serializeArray() in HTML Form of JQuery
4901 Views
HTML
<form id="frm_user_form" onsubmit="return false">
  Username: <input type="text" name="txt_username" /><br />
  Password: &nbsp;<input type="password" name="txt_password" /><br />
  <button>Show Json</button>
</form>
JQuery
$(function(){
   $("button").click(function(){
        alert(JSON.stringify($("#frm_user_form").serializeArray()));
   });
});
Demo & Output 
Demo
http://www.knowledgewalls.com/realtimejqueryeditor/serialize-array-function-in-jquery

Output
[
    {
        "name":"txt_username",
        "value":"knowledgewalls@gmail.com"
    },
    {
        "name":"txt_password",
        "value":"knowledgewalls"
    }
]
Next Topics
Next lessons of current book.
HTML Form of JQuery
Jquery Exercises of JQuery
Event handler methods of JQuery
Previous Topics
Previous lessons of current book.
HTML Insertion of JQuery
HTML Insertion of JQuery
HTML Insertion of JQuery
HTML Insertion of JQuery
Best Lessons of "JQuery"
Top lessons which are viewed more times.
HTML Insertion of JQuery
HTML Insertion of JQuery
HTML Insertion of JQuery
HTML Insertion of JQuery
Form Validation of JQuery
HTML Form of JQuery
HTML Insertion of JQuery
HTML Insertion of JQuery
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details