Hi Patrick
You're right. I have (had) not found it either, and had written this utility
to convert the serialized data into JSON, which you may find useful - the
name is a bit weird, but does the job:
// @jsfn R121.SectionMgr.params2json(parray)
// Converts parameter array received from serializing the form into JSON
$.params2json = function(d) {
if (d.constructor != Array) {
return d;
}
var data={};
for(var i=0;i<d.length;i++) {
if (typeof data[d[i].name] != 'undefined') {
if (data[d[i].name].constructor!= Array) {
data[d[i].name]=[data[d[i].name],d[i].value];
} else {
data[d[i].name].push(d[i].value);
}
} else {
data[d[i].name]=d[i].value;
}
}
return data;
};
On 3/30/07, Patrick Barnes <[EMAIL PROTECTED]> wrote:
Hi Ashutosh,
I'm using your excellent deserialize function to set UI elements via an
asynch call to some JSON data via the Yahoo UI connection manager. I also
really need to serialize the form elements to JSON. I am very new to JQuery.
I looked everywhere for "Mark Constable's serialize function", which you
mention, but I cannot find it. The closest I could find was formSerialize()
at http://www.malsup.com/jquery/form/#api, but it only serializes to a
querystring, not JSON. Any ideas on how I might do this?
Thank you,
Patrick
--
Reach1to1 Technologies
http://www.reach1to1.com
http://on2.biz
[EMAIL PROTECTED]
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/