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

Answer: 
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.
This counts as a different origin, even though you have it on the same box, just different port. 

If you are targetting mostly new browsers like FireFox 3.5 and up, you can try to add `Access-Control` headers to your application in another port and allow to call from your default app pool. Information about access control headers can be found here: <https://developer.mozilla.org/en/HTTP_access_control>

IE also implements it (again, in using a different ACTIVEX control, why so?): <http://blogs.msdn.com/ie/archive/2009/01/14/completing-access-control-support-for-xdomainrequest.aspx> and <http://msdn.microsoft.com/en-us/library/cc288060(VS.85).aspx>