-1

Can you tell me what is wrong with this code, I am new to this and have no idea, I tried everything but I can not receive the data from the server.

the alert says [object Object], do you know what this means??:

<html>
<head>
<script type="text/javascript" 

src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var sUrl =  "http://ops.epo.org/2.6.2/rest-


      // LOOP THROUGH EACH FAMILY MEMBER AND DO STUFF!
      alert(mValue)
    });
}
});
</script>
</head>
<body>
</body>
</html>
Cleber Jorge Amaral
  • 1,316
  • 13
  • 26
  • 3
    I'm thinking you mean [JSONP](http://en.wikipedia.org/wiki/JSONP)? – David Thomas Oct 23 '12 at 18:55
  • So mValue is a "complex object" (e.g. not a string or number). **Look at the actual server response;** e.g. Firebug or Developer Tools to "know" what the format of the JSON is. There is not enough context here for "why" it is what it is .. –  Oct 23 '12 at 18:58

1 Answers1

0

The alert says that mValue is an object (of "class" Object, ie. a plain JS object) which was stringified by alert to its string representation "[object Object]".

Use console.log(mValue) instead and inspect the element's properties in your developer console.

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
  • 1
    This is not *strictly* true. Consider: `function f () {}; alert(new f)` which will be "[object Object]" although it is not a "plain object". –  Oct 23 '12 at 19:00
  • OK, "plain" in this context should mean "not host object (which usually have a distinct class)", and no primitive wrapper or the like with special behaviour. Also, in his case it really is a plain object – Bergi Oct 23 '12 at 19:04
  • How can I e.g. look for a specific property of mValue and put it for example in to a text field? I am sorry but I try since hours with no success. I need just an example. – user1767121 Oct 23 '12 at 19:16
  • What do you mean by "look for"? You can access them just as you already did with the properties of `oData` – Bergi Oct 23 '12 at 20:13