You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 10, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.markdown
+64-4
Original file line number
Diff line number
Diff line change
@@ -14,17 +14,17 @@ Visualforce hosts with an endpoint of the form https://abc.na1.visual.force.com/
14
14
Dependencies
15
15
------------
16
16
17
-
The toolkit uses jQuery. It has been tested on jQuery 1.4.4, but other versions may also work.
17
+
The toolkit uses [jQuery](http://jquery.com/). It has been tested on jQuery 1.4.4, but other versions may also work.
18
18
19
19
Configuration
20
20
-------------
21
21
22
22
You must add the correct REST endpoint hostname for your instance (i.e. https://na1.salesforce.com/ or similar) as a remote site in *Your Name > Administration Setup > Security Controls > Remote Site Settings*.
23
23
24
-
Using the Toolkit
25
-
-----------------
24
+
Using the Toolkit in a Visualforce page
25
+
---------------------------------------
26
26
27
-
Create a zip file containing forcetk.js, jquery.js, and any other static resources your project may need. Upload the zip via *Your Name > App Setup > Develop > Static Resources*.
27
+
Create a zip file containing app.js, forcetk.js, jquery.js, and any other static resources your project may need. Upload the zip via *Your Name > App Setup > Develop > Static Resources*.
28
28
29
29
Your Visualforce page will need to include jQuery and the toolkit, then create a client object, passing a session ID to the constructor. An absolutely minimal sample is:
30
30
@@ -46,3 +46,63 @@ Your Visualforce page will need to include jQuery and the toolkit, then create a
46
46
</apex:page>
47
47
48
48
More fully featured samples are provided in [example.page](https://github.com/metadaddy/Force.com-JavaScript-REST-Toolkit/blob/master/example.page) and [mobile.page](https://github.com/metadaddy/Force.com-JavaScript-REST-Toolkit/blob/master/mobile.page). [Watch a brief demo of the samples](http://www.youtube.com/watch?v=qNA8nxfPgBU).
49
+
50
+
Using the Toolkit in an HTML page outside the Force.com platform
You will need to deploy proxy.php to your server, configuring CORS support (see comments in proxy.php) if your JavaScript is to be hosted on a different server.
54
+
55
+
Your HTML page will need to include jQuery and the toolkit, then create a client object, passing a session ID to the constructor. An absolutely minimal sample using OAuth to obtain a session ID is:
client = new forcetk.Client(oauthResponse.access_token,
95
+
null, oauthResponse.instance_url, proxyUrl);
96
+
97
+
client.query("SELECT Name FROM Account LIMIT 1",
98
+
function(response){
99
+
$('#message').html('The first account I see is '
100
+
+response.records[0].Name);
101
+
});
102
+
}
103
+
}
104
+
</script>
105
+
<p id="message">Click here.</p>
106
+
</html>
107
+
108
+
More fully featured samples are provided in [example.html](https://github.com/metadaddy/Force.com-JavaScript-REST-Toolkit/blob/master/example.html) and [mobile.html](https://github.com/metadaddy/Force.com-JavaScript-REST-Toolkit/blob/master/mobile.html).
0 commit comments