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

Query Salesforce in ajax outside of Salesforce?

Ajax seems to be implemented on an html page that is called within the salesforce system upon clicking a custom link.
But, is it possible launch a web page outside of salesforce and still reference the objects and retrieve information via the queries?
If so, it would appear one would need to adjust this line of code:
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", true);
Can anyone tell me if this is possible...?
Yes, the AJAX toolkit allows you to use everything the API offers... from what I understand.  To call the API from an html (javascript) page outside of you simply have to login first, like so:

var loginResult = sforceClient.login(“”, “secret”);


loginResult will then hold the usual returns... sessionid, serverurl, etc.


-Hope this helps

Just read one more thing that is good to know...  apparently if your browser security settings are too high you will have trouble doing this.  You must allow "accessing data sources across domains".
Thanks Michael.   I actually got a 'security alert box' asking for confirmation to download. Upon clicking yes the code worked. But I found a more clearer way to represent the task of extracting salesforce data into a web browser via ajax outside of salesforce:Code:
<script src="" type="text/javascript"></script>


<script language="javascript">


window.setTimeout(";", 1000);

sforceClient.init(null, null, false)

var loginResult=sforceClient.login("username", "password")

document.write (loginResult);


I am would love to be able to do this in .NET and pull  (e.g. all the names of current opportunities) into a .NET grid control on the fly without having to mess around with code. But, alas there don't seem to any examples from start to finish which show this basic task.
I messed around with the wsdl and 'login result' example in .NET but cannot get any further additional information into the grid.