+ Start a Discussion
odieodie 

Ajax Toolkit for calls from outside into Salesforce

Hi,

 

Can I use the AJAX Toolkit 14 outside of salesforce to make calls to retrieve Salesforce data?

 

I have a JSP page which I am hosting in our company website. I have a link to this page in an S-Control. This page uses connection.js, but I am unable to make AJAX calls to retrieve data. The same code works perfectly when placed in an S-Control directly.

 

Summarizing, my questions -

1) Can I use the AJAX Toolkit 14 outside of salesforce to make calls to retrieve Salesforce data?

2) If not, is there a work around thatwould allow me to make these calls from outside SF.

 

thanks a bunch,

Odie

Best Answer chosen by Admin (Salesforce Developers) 
werewolfwerewolf

1) Can I use the AJAX Toolkit 14 outside of salesforce to make calls to retrieve Salesforce data?

 

No.  Cross-domain scripting forbids such a thing.

 

2) If not, is there a work around thatwould allow me to make these calls from outside SF.

 

Make the calls on the server side in your JSP code using Java to hit the API.

All Answers

shillyershillyer

You should be able to use the AJAX Toolkit, are you using the login call? You may need to include your security token too. Take a look at the docs here: http://www.salesforce.com/us/developer/docs/ajax/Content/sforce_api_ajax_connecting.htm

 

Hope that helps,

Sati

odieodie

All,

I tried using the login call with the security token but It didnt work.

In any case, an older thread seems to address the same issue and looks like cross domain usage of connection.js is not possible. 

If anyone knows any different, please let us know.

thanks,

Odie

Message Edited by odie on 02-04-2009 05:09 PM
werewolfwerewolf

1) Can I use the AJAX Toolkit 14 outside of salesforce to make calls to retrieve Salesforce data?

 

No.  Cross-domain scripting forbids such a thing.

 

2) If not, is there a work around thatwould allow me to make these calls from outside SF.

 

Make the calls on the server side in your JSP code using Java to hit the API.

This was selected as the best answer
gcarterITgcarterIT

I also wish to use the AJAX Toolkit outside of salesforce to extract data into my own webpage which is a different domain.

 

If Werewolf's message is still true, and  this cannot be done, is the only way I can extract the data is by having a server-side script (PHP, ASP, etc.) on my domain use the saleforce api to get the data? And the then have another server-side  script display the data on my  desired webpage?

 

Please comment, correct, suggest, etc.?

 

Thanks,

George