1

I am working on an Asp.net page and have fields that aren't organized inside a form. Are there libraries that make it easier to serialize values to JSON elements that aren't in forms to a web method?

indigo0086
  • 431
  • 6
  • 13

1 Answers1

1

you might search for all inputs on the page or div and serialize them
using jquery :

jQuery.map($('input') , function(n, i){
      return {name:n.name,value:n.value};
    });

and then convert to json array using for example http://code.google.com/p/jquery-json/ by adding before

$.toJSON( jQuery.map($('input') , function(n, i){
          return {name:n.name,value:n.value};
        }));
firegnom
  • 833
  • 7
  • 20
  • After some searching this idea seemed to be the eventual outcome, was hoping there was some library already set in place. Guess I can expand it to set element attributes on elements with bind properties and build something around that. Thanks! – indigo0086 Apr 18 '11 at 15:12