<p>I would like to make an ajax call to a different server (same domain and box, just a different port.)
e.g.</p>

<p>My page is</p>

<pre>
http://localhost/index.html
</pre>

<p>I would like to make a ajax get request to:</p>

<pre>
http://localhost:7076/?word=foo
</pre>

<p>I am getting this error:</p>

<pre>
Access to restricted URI denied (NS_ERROR_DOM_BAD_URI) 
</pre>

<p>I know that you can not make an ajax request to a different domain, but it seem this also included different ports? are there any workarounds?</p>

[{'answer_id': 57435, 'author': 'Joseph Bui', 'author_id': 3275, 'author_profile': 'https://Stackoverflow.com/users/3275', 'pm_score': 3, 'selected': True, 'text': '<p>Have a certain page on your port 80 server proxy requests to the other port. For example:</p>\n\n<pre><code>http://localhost/proxy?port=7076&amp;url=%2f%3fword%3dfoo\n</code></pre>\n\n<p>Note the url encoding on the last query string argument value.</p>\n'}, {'answer_id': 57441, 'author': 'Luke Smith', 'author_id': 5556, 'author_profile': 'https://Stackoverflow.com/users/5556', 'pm_score': 1, 'selected': False, 'text': '<p>You could use JSONP. This is where you specify a callback with the request, the response from your ajax request gets wrapped with the callback function name. Rather than using XmlHttpRequest you insert a  tag into the HTML document with the URL. Then when the response is retrieved the callback function is called, passing the data as a parameter.</p>\n\n<p>Check this <a href="http://www.west-wind.com/Weblog/posts/107136.aspx" rel="nofollow noreferrer">blog post</a> out for an example</p>\n'}, {'answer_id': 57442, 'author': 'sblundy', 'author_id': 4893, 'author_profile': 'https://Stackoverflow.com/users/4893', 'pm_score': 0, 'selected': False, 'text': '<p>This is a browser restriction. All javascript calls must be to the same server and port of the home of the script. This will require something server-side to get around. I.E. have the process at <code>localhost</code> forward the request to <code>localhost:7076</code>.</p>\n'}, {'answer_id': 57444, 'author': 'matt', 'author_id': 2646, 'author_profile': 'https://Stackoverflow.com/users/2646', 'pm_score': 0, 'selected': False, 'text': "<p>It sucks, but it's necessary... Basically what you're going to need to do is proxy your AJAX request through a local proxy - some server side script / page / whatever on the same domain you're on - receive the call and forward it on to the other resource server-side. There might be some IFRAME tricks you could do but I don't think they work very well...could be wrong though, been awhile.</p>\n"}]
['https://Stackoverflow.com/questions/57421', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1638/']