Is there a way to json serialize fields that aren't stored within a form in asp.net
I am working on an Asp.net p开发者_Go百科age 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?
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};
}));
精彩评论