开发者

Is there a way to json serialize fields that aren't stored within a form in asp.net

开发者 https://www.devze.com 2023-02-26 22:45 出处:网络
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

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};
        }));
0

精彩评论

暂无评论...
验证码 换一张
取 消