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?
1 Answer
Reset to default 23JSON.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.