Passing javascript objects as function arguments

Posted by Prashant on Stack Overflow See other posts from Stack Overflow or by Prashant
Published on 2010-03-16T06:28:35Z Indexed on 2010/03/16 6:36 UTC
Read the original article Hit count: 392

Filed under:

Hello all
I want to pass a javascript object (JSON) as an argument to another function. But i am getting following error:

missing ] after element list

the function is called on onclick event of href like

"<a href='javascript:void(0);' onclick='javascript:openTab("+ sTab +");'>"+ sTab['SavedTab']['title'] +"</a><br/>";

When i pass whole value : sTab['SavedTab']['title'] , it works fine but i want to pass whole object, not just single value out of it.

Please help me out. Thanks.

© Stack Overflow or respective owner

Related posts about JSON