开发者

JSON push not working from ascx

Hi I have a json object that i have declared in the master page. I want to push few elements in it from the ascx controls that are loaded

For. e.g.

Master page

 em = {
       d: [ { ID: "txt_Username", HelpID: "1" } ]
       }

 em.d.push({ ID: "txt_StatusUpdate", HelpID: "3" });
 em.d.push({ ID: "txt_textarea", HelpID: "4" });

This works. But the same em.d.push({ ID: "txt_StatusUpdate", HelpID: "3" }); in the javascript of ascx doesnt work. What am I doing wrong? I need to access this em object from the javascript of the master page and I need a single object that has this value pairs. What am I do开发者_如何学Pythoning wrong here? Thoughts?


Look at the generated source code. If push method is called before em is defined, it doesn't work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜