Question: I've set up NodeJS and it's returning data when I browse to the URL: <http://184.106.206.235>

However, when I try to call that URL using `$.getJSON`, the callback shows `null` for the `data` variable and `"success"` for the `textStatus` variable.

I imagine this could be a cross-domain thing, but I'm surprised that the `textStatus` says `"success"` if that's the case.

In case it's helpful, here's the server-side JS:

```
http.createServer(function(req, res){
  var output = {message: "Hello World!"};
  var body = JSON.stringify(output);

  res.writeHead(200, {'Content-Type': 'application/json', 'Content-Length': body.length});
  res.end(body);
}).listen(80, "184.106.206.235");

```

Any ideas?

Answer: 
Add the "Access-Control-Allow-Origin": "\*" property to your writeHead() call:

```
res.writeHead(200, {
  "Content-Type": "application/json",
  "Access-Control-Allow-Origin": "*"
});

```
if you are using [express](http://expressjs.com/guide.html#res.json%28%29) framework you can try one of the following:  

1. `res.contentType('json');` to set to content type.  

2. `res.send({ some: 'json' });` that will set the content type and parse it for you.  

3. `res.json({ user: 'tj' });` probably the best way to do it.   

hope it helps :)