创星网络[分享知识 传递快乐]

标题: jquery-json [打印本页]

作者: luinstein    时间: 2012-12-13 23:01
标题: jquery-json
Important: 2.0 is not backwards compatible with the previous versions.  Changes in version 2.0 are described below.
This plugin makes it simple to convert to and from JSON:
var thing = {plugin: 'jquery-json', version: 2.3};

var encoded = $.toJSON( thing );
// '{"plugin":"jquery-json","version":2.3}'
var name = $.evalJSON( encoded ).plugin;
// "jquery-json"
var version = $.evalJSON(encoded).version;
// 2.3Most people asked me why I would want to do such a thing, which boggles my mind.  JavaScript makes it relatively easy to convert from JSON, thanks to eval(), but converting to JSON is supposedly  an edge requirement.
This plugin exposes four new functions onto the $, or jQuery object:
Changes in Version 2.3
Changes in Version 2.0

from:http://go.cxweb.com.cn/95bvq





欢迎光临 创星网络[分享知识 传递快乐] (http://bbs.cxweb.com.cn/) Powered by Discuz! X3