标签:htm color for input 后台 splay 结构 技术交流 info
public class Order{ public string orderId{get;set;} public OrderItem orderItem{get;set;} } public class OrderItem{ public string productName{get;set;}
public decimal price{get;set;} }
<form id="form1"> <input type="text" name="productName" value="milk" /> <input type="text" name="price" value="1.43" /> <input type="submit" name="submit" value="submit" /> </form>
{orderItem.productName:"",orderItem.price:""}
;(function ($) { $.fn.serializeJson = function () { var serializeObj = {} var array = this.serializeArray() var str = this.serialize() $(array).each(function () { if (serializeObj[this.name]) { if ($.isArray(serializeObj[this.name])) { serializeObj[this.name].push(this.value) } else { serializeObj[this.name] = [serializeObj[this.name], this.value] } } else { serializeObj[this.name] = this.value } }) return serializeObj } })(jQuery);
var formParam=$("#form1").serializeJson(); console.log(JSON.stringify(formParam))
var formParam=$("#form1").serializeJson(); console.log(JSON.stringify(formParam)) console.log($.param(formParam))
如果您有更好的解决方法欢迎留言讨论或者加入下面的QQ群来交流讨论
技术交流QQ群:15129679
标签:htm color for input 后台 splay 结构 技术交流 info
原文地址:http://www.cnblogs.com/yeminglong/p/7456885.html