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> \
</soapenv:Envelope>";
function Result(xData, status) {
alert(xData.responseText);
$(xData.responseXML).find("z\\:row").each(function() {
var title = $(this).attr("ows_Title");
alert(title);
});
}
$.ajax({
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\"",
error:function(){
alert("Error");
}
});