0

Using jQuery, I have loaded some data to an object defined by var tmp={}.

Somehow the data will be displayed by console.dir(tmp), but I cannot get some values by accessing it directly (e.g. tmp.val)!

The object I am storing data to is called tmp in the following example. Unfortunately, I cannot present the complete code how the data is gathered since it is too much. What I can present is the output.

console.log(tmp)

$.each(tmp,function(key,val){
    console.log(key);
});

The fist line will display:

Object
  class: "modul7"
  class_name: "Some kind of class name."
  collectionRelevant: 1

The second code will display:

class
class_name

The collectionRelevant is missing.

I know my question is vague.

Has anyone stumbled over something like this? I have no clue anymore in which direction to seek the error.

gen_Eric
  • 223,194
  • 41
  • 299
  • 337

1 Answers1

0

I think native JavaScript should be enough for this task.

for( var key in tmp ) {
  // key
  console.log(key);
  // value
  console.log(tmp[key]);
}​​​​​ ​
Alexander
  • 23,432
  • 11
  • 63
  • 73