Json error on Javascript-Collection of common programming errors

I need some help finding out what’s wrong in this code:

ajaxRequest.open("POST", "http://localhost:8181/add", true)
ajaxRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
ajaxRequest.send(data);

I’m trying to send data to the server using POST, and ajaxRequest is an ajaxRequestElement().

The problem is when I open the page, the console provided by Chrome to detect Javascript errors says POST http://localhost:8181/add undefined (undefined).

I know the URL is correct and the page receiving the data is ok too, I tried this before in PHP and works fine, so I don’t understand what’s happening.

Originally posted 2013-11-09 23:06:29.