I've been going around in circles for a couple hours now to no avail. I had thought that what I wanted to do was not possible but some threads that I was reading on SO were saying otherwise so I pursued it. I need to GetListItems from a SharePoint list on a different server. I have tried different codes but they all error out. Can someone look at what I have and see if it's wrong or if it's just not possible? I get the Error alert then an xData.ResponseText alert as 'undefined'. Nothing after that. The server where I'm running the code is teams03.intranet.com. Thank you.

    var soapEnv =
        "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
            <soapenv:Body> \
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                    <listName>Shared Documents</listName> \
                    <viewFields> \
                        <ViewFields> \
                            <FieldRef Name='Title' /> \
                       </ViewFields> \
                    </viewFields> \
                </GetListItems> \
            </soapenv:Body> \

function Result(xData, status) {
    $(xData.responseXML).find("z\\:row").each(function() {
        var title = $(this).attr("ows_Title");

        url: "http://teams02.intranet.com/sites/MySite/_vti_bin/Lists.asmx",
        type: "POST",
        dataType: "JSONP",
        crossDomain: true,
        data: soapEnv,
        complete: Result,
        contentType: "text/xml; charset=\"utf-8\"",
  • did you try to set the document.domain ? document.domain = 'intranet.com'; $.ajax({ .... }); – Eric Mar 28 '12 at 2:49

regarding jQuery and $.ajax you might be having the following trouble regardless of your settings on the ajax call.


From the documentation:

Additional Notes: Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol. Script and JSONP requests are not subject to the same origin policy restrictions.

Try verifying that you use the correct MIME-type, if the one your using not doesn't work try this one application/json it is the official one for sending JSON, don't know how it will work with JSONP though.

Edit: I just checked your example again, your not sending JSONP your sending XML. And also JSONP doesn't support POST only GET. Here is an example http://www.jquery4u.com/json/jsonp-examples/#.UCdd0p2iPEU

| improve this answer | |
  • 1
    JSONP works by adding a script tag to the document, which triggers the browser to download and run (it expects javascript to be returned!) the response returned from the service url. SharePoint SOAP web services do not support JSONP as the response does not contain executable javascript. – Jaap Vossers Aug 23 '12 at 8:22

Not sure if we are talking about the same thing or not, but have you seen this?


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.