Note that there are some explanatory texts on larger screens.

plurals
  1. POSame origin policy problem calling sharepoint web service
    primarykey
    data
    text
    <p>I am trying to call the pre-defined web services from the sharepoint server but am unable to due to the same origin policy problem and cannot find a solution to it. I tried setting document.domain to the server name and server port but instead it throws a DOM Security Error 18 which is also the same problem as the previous error. I am just trying to call the getLists method to test whether it works and the code is taken from a tutorial then I have seen online from <a href="http://mydevexperience.wordpress.com/2011/05/08/sharepoint-list-access-part-i-how-to-access-sharepoint-list-web-service-using-jquery-entirely-client-side-only/" rel="nofollow">here</a>. Any help much appreciated. Thanks in advance.</p> <p>My code is as follow:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { document.domain = 'http://servername:serverport' var soapEnv = "&lt;soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'&gt; \ &lt;soapenv:Body&gt; \ &lt;GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'&gt; \ &lt;listName&gt;Occupations&lt;/listName&gt; \ &lt;viewFields&gt; \ &lt;ViewFields&gt; \ &lt;FieldRef Name='Title' /&gt; \ &lt;/ViewFields&gt; \ &lt;/viewFields&gt; \ &lt;/GetListItems&gt; \ &lt;/soapenv:Body&gt; \ &lt;/soapenv:Envelope&gt;"; // Call web service $.ajax({ url: "http://servername:serverport/_vti_bin/lists.asmx", type: "POST", dataType: "xml", data: soapEnv, complete: processListAccessResult, contentType: "text/xml; charset=\"utf-8\"" }); }); // Process result function processListAccessResult(xData, status) { $(xData.responseXML).find("z\\:row").each(function () { $("#data").append("&lt;li&gt;" + $(this).attr("ows_Title") + "&lt;/li&gt;"); }); } &lt;/script&gt; &lt;ul id="data"&gt;&lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload