开发者

Why is there no serialize to JSON in jQuery? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be imp开发者_StackOverflow中文版roved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

Hi a couple of days ago I had to post a js object to the server via ajax and I discovered there was no way to convert an object to JSON using jQuery.

So it's really a two part question: 1. Why is a toJSON() method not included in jQuery and 2. what is the best way to post a js object to the server?

Cheers,

Joe


normally you dont pass JSON but you serialize your data, hence the .serialize() it's normally the server that sends json... not the client.

the best way is to serialize the object.

http://api.jquery.com/serialize/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜