If I have a site, completely independent of Microsoft (a Wordpress site), could I access data from lists on a SharePoint site using JS on the external site? For example, I can access lists with the following code in the SharePoint site:
function retrieveChemicalsListItems() {
var clientContext = new SP.ClientContext('/sites/________/');
var oList = clientContext.get_web().get_lists().getByTitle('ChemicalsTable');
var camlQuery = new SP.CamlQuery();
//<Where><Geq><FieldRef Name=\'ID\'/>' + '<Value Type=\'Number\'>1</Value></Geq></Where> <RowLimit>10</RowLimit>
camlQuery.set_viewXml('<View><Query></Query></View>');
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onChemicalsQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
If I just took this, with the same URL and everything, and put it on any other site, would it work just the same?