Hi I need some help with OOP in JS...
I have an object with a single Method to load content from a xml file. The problem is... how do I add a property to the object to store the data loaded?? I tryed adding a simple Array inside the object, but didn't work.
Code:function DataCollection() { this.load = function(filename) { $.get(filename, function(xml){ $(xml).find("marker").each( function(){ var name = $(this).find('name').text(); var address = $(this).find('address').text(); var lat = $(this).find('lat').text(); var lng = $(this).find('lng').text(); var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng)); *** HERE...add point to a collection (may an array) as property inside DataCollection object }); }); } } var dc = new DataCollection(); dc.load();
Thanks!


Reply With Quote

Bookmarks