php - jQuery json_encode -
i've looked around javascript/jquery function emulates php's json_encode
, ones find (listed bellow) don't work.
to check if wasn't array wasn't faulty used phpjs var_dump
expected results.
can point me in right direction?
the problem cannot this:
ret[$(this).attr("id")] = _recursiveitems(this);
because var ret = []
declares ret
array , not object , $(this).attr("id")
non-numeric (its value head_1
). attempting create associative array not supported.. javascript associative arrays are meant numeric , considered harmful.
if change declaration var ret = {}
can use jquery-json convert object json. here demo using code in question.
Comments
Post a Comment