Best practices for getting cross-site JSON responses to POST?

ajax, javascript, json, mod-rewrite, php

Solution

just look at this https://developer.mozilla.org/En/HTTP_access_control page. All what you need - add header to all you scripts that accept post request. Example:

Problem

I'm working on an intranet with several subdomains. I have control over each subdomain, so security of cross-site requests is not a concern. I have PHP scripts with JSON responses I'd like to call from multiple subdomains without duplication. For GET requests, I can do this with AJAX and JSONP, but that doesn't work with POST requests. Some alternatives I see, none of which seem very good: - POST to a copy on local subdomain with minimal response, then GET full response from central location with JSONP - Both POST and GET to a copy on local subdomain with JSON - Use mod_rewrite to use local URLs with a central script on back end with JSON - Use symlinks to use local URLs with a central script on back end with JSON Am I missing something simpler? What would you do here?

Original source