I have been developing a JSON/XML-RPC server class in PHP, implementing the current XML-RPC spec and the JSON-RPC 1.1 draft spec. One issue not addressed in the JSON-RPC spec is that of making cross-site RPC requests. As you know, such requests do not use XMLHttpRequest but work by dynamically inserting SCRIPT tags into the document. In order for the response to be processed, the JSON data contained inside the newly loaded JavaScript file is only accessible if it passed into a user-specified callback function. For example, accessing the JSON data for a Google Calendar feed, one must specify a "callback" query parameter in the URL of the SCRIPT element9;s SRC attribute like this: http://...public/full?alt=JSON-in-script&callback=processData
Then the JavaScript code returned will look like this:
processData({"feed":...});
As the JSON-RPC 1.1 draft spec standardizes making requests via HTTP GET, I propose that an additional HTTP GET parameter be standardized such as "JSON-response-callback". This parameter would not be passed to the method invoked by the request. The data passed into the callback function would be the JSON-RPC procedure return object.
For example, if I invoked a method via the following URL: http://services.com/math/add?JSON-response-callback=displaySum&num1=1&num2=1
Then the document loaded would be the JavaScript data:
displaySum({"version":"1.1","result":2});
Weston