One of the things you can try is explicitly waiting for that particular element to be loaded before trying to call .width() and .height().
Try this:
$('#lightingData').load(function() {
...height and width manipulation here...
...don't forget about scope...
});
You should put this inside your $(document).ready(...), as you will want the document to at least know what $('#lightingData') is. Because you are getting 0 for the height and width and not errors, I can assume that they are at least found, before the methods are called.
UPDATE
Per the comments added by @Ian, I want to point out that this will only work for certain types of elements (URL, IFrames, Images/media, etc. - basically anything that needs to load its content). I am not going to update the code, since what I have above is correct if you are using it for one of these kinds of elements, and would be silly if you are using it for another. If you are using it for both, you need only add a condition/filter (based on your implementation) to determine if this code should be bound to that particular element.