I'm trying to serialize to URL string an associative array whose elements are defined at runtime in the form of arr[key]=value
, where key and value are determined at runtime, but arr
is predefined as a global before runtime. I can't get the param()
function to work with this kind of array. Is there another function to use to serialize such arrays?
var arr=[];
arr["apple"]="poisoned";
arr["banana"]="digested";
var str=jQuery.param(arr);
$("#results").text(str);