using of Ajax with webservices for SharePoint data.
$(document).ready(function() {
var webserviceurl = "https://mysiteurl/_vti_bin/lists.asmx";
var soapEnv =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetListCollection xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
</GetListCollection> \
</soapenv:Body> \
</soapenv:Envelope>";
$.ajax({
url: webserviceurl ,
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=\"utf-8\""
});
function processResult(xData, status) {
var res = '';
//alert(xData.responseText)
$(xData.responseXML).find("List").each(function() {
res += $(this).attr("Title")+'\n';
});
//returns all list in the current site.
alert(res );
}
});
$(document).ready(function() {
var webserviceurl = "https://mysiteurl/_vti_bin/lists.asmx";
var soapEnv =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetListCollection xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
</GetListCollection> \
</soapenv:Body> \
</soapenv:Envelope>";
$.ajax({
url: webserviceurl ,
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=\"utf-8\""
});
function processResult(xData, status) {
var res = '';
//alert(xData.responseText)
$(xData.responseXML).find("List").each(function() {
res += $(this).attr("Title")+'\n';
});
//returns all list in the current site.
alert(res );
}
});
No comments:
Post a Comment