3

I'm using Orbited as a Comet server on localhost. It is listening to ports:

9000 for http
61613 for stomp

My JavaScript debugger is reporting error: JSON is not defined in the line:

var vals = JSON.parse(payload);

What could be the cause and how do I resolve this issue?

David Locke
  • 17,926
  • 9
  • 33
  • 53
Alex
  • 43,191
  • 44
  • 96
  • 127

2 Answers2

1

The JSON library is not built into Javascript. You must include a javascript JSON library. If you use the one I linked, your code should work.

Alternatively, since JSON is a subset of Javascript object literals, you may be able to do this:

var vals = eval('(' + payload + ')');
Kenan Banks
  • 207,056
  • 34
  • 155
  • 173
0

You must have a javascript include tag that loads the orbited json library in your html page

For your setup it will be located at http://:9000/static/JSON.js