Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
AJAX Proxy
The AJAX proxy is part of the AJAX Toolkit. Access it using remoteFunction defined in connection.js. You can specify any HTTP method in remoteFunction, for example HTTP GET or POST, and it will be forwarded to the external service.
The following examples illustrate typical approaches for GET and POST:
GET Example:
1sforce.connection.remoteFunction({
2 url : "http://www.myExternalServer.com",
3 onSuccess : function(response) {
4 alert("result" + response);
5 }
6 });POST Example:
1var envelope = ""; //request envelope, empty for this example
2 sforce.connection.remoteFunction({
3 url : "http://services.xmethods.net:80/soap",
4 requestHeaders: {"Content-Type":"text/xml",
5 "SOAPAction": "\"\""
6 },
7 requestData: envelope,
8 method: "POST",
9 onSuccess : function(response) {
10 sforce.debug.log(response);
11 },
12 onFailure : function(response) {
13 alert("Failed" + response)
14 }
15 });