You need to sign in to do that
Don't have an account?
![sf.freelance sf.freelance](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Is it possible to use the salesforce AJAX with visualforce pages deployed on Sites?
Hi
I created a VF page with Ajax. It can get fields value from SF with javascript.
All that works well in suck link: xxxx.salesforce.com/apex/xxxxxx. But after I put this VF page on sites, it can not get any data.
My VF page ajax code is as below:
try { sforce.connection.login("xxx@xxx.com", "xxxxpasswordxxxxsecurityToken");
alert("Login Success");
var result = sforce.connection.query("SELECT c.Id, c.Name, c.Email, c.Account.Name FROM Contact c");
xxxxxxx some logic.
} catch(e) { alert(e); }
It threw some error message:{faultcode:'UNKNOWN_EXCEPTION',faultstring:'UNKNOWN_EXCEPTION:Site under construction',}
In VF page, it can works well, but in site this line threw error
sforce.connection.login("xxx@xxx.com", "xxxxpasswordxxxxsecurityToken");
Who can help me?
Thanks
![](/forums/img/s.gif)
![](/forums/img/s.gif)
![aalbert aalbert](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)