Question: I need to send an AJAX request to, for example, port 8080 where a daemon is running there.

Answer: 
You cannot `POST` information cross domain, subdomain, or port number. You can however use JSONP if you have access to both the daemon *and* the requesting site. If data needs to be returned, then the `daemon` needs to support a `callback` query parameter and return it properly formatted.

Pass the information to the daemon:

```
$.getJSON('http://domain.com:8080/url/here?callback=?', {
  key: 'value',
  otherKey: 'otherValue'
}, function(data){
     // Handles the callback when the data returns
});

```

Now just make sure your daemon handles the `callback` parameter. For instance, if `callback=mycallback` the return from the daemon (the only thing written to the page) should look like this:

For an key/value pairs:

```
mycallback( {'returnkey':'returnvalue', 'other':'data' });

```

For an array:

```
mycallback( [1,2,3] );

```

If you do not have a JSONP or similar mechanism in place, you cannot communicate cross domain using jQuery.
This breaks the [Same origin policy](https://developer.mozilla.org/en/Same_origin_policy_for_JavaScript). You cannot use a different port, even when using the same domain.

You can use JSONP as [Doug](https://stackoverflow.com/questions/2099728/how-to-send-request-to-non-80-port-on-the-same-site-with-jquery/2099771#2099771) suggested.

Or else, as another possible workaround, you could set up a very simple [reverse proxy](http://en.wikipedia.org/wiki/Reverse_proxy) (using [mod\_proxy](http://httpd.apache.org/docs/2.0/mod/mod_proxy.html) if you are on Apache). This would allow you to use relative paths in your AJAX request, while the HTTP server would be acting as a proxy to any "remote" location. 

The fundamental configuration directive to set up a reverse proxy in [mod\_proxy](http://httpd.apache.org/docs/2.0/mod/mod_proxy.html) is the ProxyPass. You would typically use it as follows:

```
ProxyPass     /ajax/     http://www.localhost:8080/

```

In this case, you would request `/ajax/test.xml` with jQuery, but in fact the server would serve this by acting as a proxy to `http://www.localhost:8080/test.xml` internally. 

If you are using IIS, you may want to use the [Managed Fusion URL Rewriter and Reverse Proxy](http://www.codeplex.com/Wikipage?ProjectName=urlrewriter) to set up a reverse proxy.