最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What is the difference between jQuery serialize() method vs JSON.stringify()? - Stack Overflow

programmeradmin2浏览0评论

Maybe I'm getting this all mixed up, but reading about jQuery's serialize() method has gotten be confused. I normally use JSON.stringify() when I need to serialize an object for an AJAX request. Are these two methods similar in any way?

Maybe I'm getting this all mixed up, but reading about jQuery's serialize() method has gotten be confused. I normally use JSON.stringify() when I need to serialize an object for an AJAX request. Are these two methods similar in any way?

Share Improve this question asked Mar 30, 2014 at 9:24 biddanobiddano 4916 silver badges16 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 23

JSON.stringify produces application/json data from a JavaScript object or array.

jQuery.serialize produces application/x-www-form-urlencoded data (the standard encoding for HTML form submissions) from a jQuery object containing an HTML Form Element or a set of form controls.

发布评论

评论列表(0)

  1. 暂无评论