function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
REST API and JavaScritpsREST API and JavaScritps 

With javascritps example

Hi.

 

You know, how I could connect to Salesforce but using javascripts. My goal is to create a gadget from the test mashup platform (EZWEB, http://ezweb.tid.es), to obtain records from Salesforce Account table.

I actually managed to run the sample test java REST API. But I still do not work using javascripts, still relied upon the comments of the community of Rest API Integration.

I appreciate any help.

Greetings

Pat PattersonPat Patterson

I think the problem you will encounter here is that JavaScript's same origin policy will prevent you from making requests to any salesforce.com URL from a script loaded from ezweb.tid.es. I believe we will be doing some work to make this possible at some time in the future - alext may be able to comment further.

gwestrgwestr

You can source one of the javascript libraries on our domain.  Then your user's browser can make same-domain RESTful requests to our service.  Here are a few:

 

https://{instance}.salesforce.com/EXT/ext-3.1.2/ext.js

 

https://{instance}.salesforce.com/js/jquery.js

 

https://{instance}.salesforce.com/js/dojo/0.9/dojo/dojo.js

 

https://{instance}.salesforce.com/js/scriptaculous/scriptaculous.js

 

Let me know if there is another library you're looking for.

 

EDIT: You should probably upload the javascript library of choice as static resource because there is no guarantee these files will live here forever.  This solution would only work if you are using Apex/Visualforce and you are being served from the domain salesforce.com rather than visual.force.com.  If you're doing this from your own domain, use a simple proxy page on your server to funnel the data to your client.  JSONp is a workaround that Salesforce is not currently supporting.  postMessage() in HTML5 is on the horizon.  Cross Origin Resource Sharing is a draft not yet ratified as a standard, and is another future solution to this thorny problem (when the security problems are overcome).