Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Monday, December 05, 2011

Retrieving a SharePoint List Data Using JQuery.

<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var soapEnv =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>Tasks</listName> \
<viewFields> \
<ViewFields> \
<FieldRef Name='Title' /> \
</ViewFields> \
</viewFields> \
</GetListItems> \
</soapenv:Body> \
</soapenv:Envelope>";
$.ajax({
url: "_vti_bin/lists.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult1,
contentType: "text/xml; charset=\"utf-8\""
});
});
function processResult1(xData, status) {
$(xData.responseXML).find("z\\:row").each(function() {
var liHtml1 = "<li>" + $(this).attr("ows_Title") + "</li>";
$("#tasksUL").append(liHtml1);
});
}
</script>
<ul id="tasksUL"/>

No comments:

Post a Comment