Search code examples
javascriptjsongetxmlhttprequestput

How to process multiple api requests in one


For example I have some_website/a.json which contains:

{"test":"1","test2":"2"}

and some_website/b.json which contains:

{"test":"3","test2":"4"}

how i can GET and PUT this values in some_website/c.json using XMLHttpRequest like

{"testing1":{"test":"1","test2":"2"},"testing2":{"test":"3","test2":"4"}}

Solution

  • This is not natively possible. There are techniques like “Batch Requests”. Facebook implemented them in their API, for example. Facebook Batch Request