How to create a custom JSON based on form values?
<p>I am creating a JSON based on a dynamic form values below, when the user submits, i am displaying the json feed in #results</p>

<p>Is it also possible to get all the values in the form when generating the JSON, I want to get the </p>

<ul>
<li>name, ids,  </li>
<li>title information,</li>
<li><p>input value etc</p>

<p>and then create/display the JSON in the order below?</p></li>
</ul>

<p>A working version can viewed here :</p>

<p><a href="http://jsfiddle.net/dev1212/GP2Y6/25/" rel="nofollow">http://jsfiddle.net/dev1212/GP2Y6/25/</a></p>

<p>Currently its not retuning any values and getting some undefined..
the code peice i tried is below</p>

<pre><code>&lt;script&gt;

    x = function(selector){

        var attrs = [];

        $(selector + " input").each(function(){

            var attrObject = {};

            $(this.attributes).each(function(index, attr){

                attrObject[attr.name] = attr.value;
 attrObject[attr.va] = attr.value;
                //console.log(attrObject)
            });

            attrs.push(attrObject);
            attrObject = {};

        });

        return attrs;
    }

    $(document).ready(function(){

        alert(JSON.stringify(x("#myform")));

    });

&lt;/script&gt;
</code></pre>
