Solved

push to new array

Posted on 2013-12-30
2
199 Views
Last Modified: 2013-12-30
Dear all,
I got an error if it try to push to new array:
var DialogView = {};
DialogView.items.push({"name": "Dlg", "title": "Dlg01",  "width": 300,"height": 150 ,"ProductID":  1});

Open in new window

But I got error : TypeError: DialogView is null
0
Comment
Question by:ethar1
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
var DialogView = {};
DialogView.items = [];
DialogView.items.push({"name": "Dlg", "title": "Dlg01",  "width": 300,"height": 150 ,"ProductID":  1});
// now you've :
//{
//   items : [{
//       "name": "Dlg",
//       "title": "Dlg01",
//       "width": 300,
//       "height": 150 ,
//       "ProductID":  1}]
//}

Test page : http://jsfiddle.net/zxSea/
0
 

Author Closing Comment

by:ethar1
Comment Utility
thanks
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now