jQuery .load() from local httpd (node)

Node.js server

var http = require("http");
http.createServer(function(request,response){
    console.log("client connected");
    response.writeHeader(200,{"Content-type": "text/html"}); 
    response.write("Hello ;-)");
    response.end();
}).listen(9090);

I try to load the server output into a div with the ID "myDisplayField":

$("#myDisplayField").load("http://localhost:9090");

(The HTML-File lies on my local httpd)

The issu I'm having with that is that the node server may show that he got a request from ajax ("client connected"), but "Hello ;-)"/the site content doesn't get loaded into #myDisplayField as expteced.

If I set up a webserver like Apache and put a index.html with "Hello ;-)" in htdocs, the whole thing works just fine.

What am I doing wrong?

I just tried your code, and navigating to localhost:9090 displays the 'hello' body as expected.

It may be that jquery's load() method looks for other data - for example, content-type in the header - that your very simple response doesn't provide. Instead of building every http response individually, you should use a higher-level server like express:

var express = require('express');
var app = express();

app.use(function(req, res, next) {
  res.send('Hello');
});

app.listen(9090);