I am struggling with this, I am still new to javascript, and I am trying to use the jquery $ .inarray function as I need to find the value in the array so that I can return other values from the same array as “string”, for example, its identifier.
When I try to use a jquery inarray function like this, I simply return -1, saying that it does not exist, when I know that the value exists, nested in an array. I'm not sure how to approach this, so that I can look for meaning, any advice is welcome.
valuereturn = $.inArray("search_for_value", jsonarray) ;
alert (valuereturn)
EDIT 2:
Here is the result of my cakephp JSON echo:
{"getdata":[{"Uiemail":{"uiemail_id":"2","divid":"upd1","width":"200","height":"200","leftpos":"122","toppos":"122","cssgroup":"1","colortop":"","colorbottom":"","colorborder":"","borderwidth":"","zindex":""}},
{"Uiemail":{"uiemail_id":"3","divid":"upd2","width":"200","height":"200","leftpos":"333","toppos":"444","cssgroup":"1","colortop":"","colorbottom":"","colorborder":"","borderwidth":"","zindex":""}},
{"Uiemail":{"uiemail_id":"4","divid":"upd3","width":"200","height":"200","leftpos":"555","toppos":"466","cssgroup":"1","colortop":"","colorbottom":"","colorborder":"","borderwidth":"","zindex":""}}]}
EDIT:
In addition, here is the conclusion:
alert(typeof jsonarray+'\n'+jsonarray.length)
output= "object 3 "
I tried this too, but it gives no value and makes errors on my page:
alert(jsonararray)