I'm using Java to create a web service interface on the server. I'm using Camel to do the service layer and Jetty to expose it to the web. One problem with Jetty is that it takes over ALL requests on the server and port it's listening on. Because of this, I have Jetty listen on port 6700 so I can still get normal HTTP requests on port 80. Also, because Camel just consumes Jetty endpoints, there are no actual files that I POST to. So Jetty may be listening for requests on http://localhost/TestPage, but there is no TestPage file.
My problem is that on the client side, I need to be able to make AJAX requests to the services, but I can't rely on them being on the same server, as they might not be one day. I have a service (call it http://localhost/TestPage) that takes no input but returns JSON data. How can I make the AJAX request to get the JSON data? (Feel free to mention any libraries. I'll use them.) I'm also open to using PHP to help, but keep in mind that I can't actually edit the 'page' that I'm posting to.
I don't know if anybody else will ever have this same problem, but I was able to solve it. What I did was add "Access-Control-Allow-Origin" to the header of the response with the value "*". (I'll be changing the * to http://mydomain.com/ when we launch so I can keep the requests private.)