== Cross-domain requests using a proxy server ==

The JavaScript same-origin policy normally prevents browsers from sending [[AJAX]] requests to a different domain and receiving a response (newer browsers that support [[Cross-Origin Resource Sharing|CORS]] can relax this constraint).  A cooperating proxy server, however, does not have such restrictions and can relay a browser request to a server in a separate domain, store the result, and then return that  JSON payload when the browser makes a second request. The server would be instructed within the first request to store the output (POST returning JSON payload) temporarily into a local store (for example memcached or within a session variable), and a second request from the browser then would fetch the cached response to the initial query.<ref>http://www.flinkwise.com/technology-blog/a-way-to-send-json-p-post-requests-to-another-domain-with-jquery-and-rails-in-the-back-end/</ref> The xd_arbiter.php used by Facebook's JS SDK is a popular example of this cooperating server technique.<ref>{{cite web|last=Kinsey|first=Sean|title=Facebook and Cross domain messaging clarification?|url=http://stackoverflow.com/questions/16862207/facebook-and-cross-domain-messaging-clarification|publisher=Stack Exchange, Inc.|accessdate=22 November 2013}}</ref>