javascript - Getting list data from SharePoint 2010 site using Jquery -
javascript - Getting list data from SharePoint 2010 site using Jquery -
i trying list info sharepoint site using jquery, have got nil returned yet, no errors in firebug either. clue wrong?
<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>action items</listname> \ <viewfields> \ <viewfields> \ <fieldref name='title' /> \ </viewfields> \ </viewfields> \ </getlistitems> \ </soapenv:body> \ </soapenv:envelope>"; $.ajax({ url: "http://my_site/_vti_bin/lists.asmx", type: "post", datatype: "xml", data: soapenv, complete: processresult, contenttype: "text/xml; charset=\"utf-8\"" }); }); function processresult(xdata, status) { $(xdata.responsexml).find("z\\:row").each(function() { console.log("aaaa"); var lihtml = "<li>" + $(this).attr("ows_title") + "</li>"; $("#tasksul").append(lihtml); }); }
right after line
function processresult(xdata, status) { add alert this:
alert(xdata.responsetext); that show coming phone call getlistitems.
also, should alter line:
$(xdata.responsexml).find("z\\:row"). to this:
$(xdata.responsexml).find("[nodename='z:row']") which more reliable across browsers. (see blog post: http://sympmarc.com/2009/11/08/sharepoints-web-services-jquery-and-the-zrow-namespace-in-safari-and-chrome/)
as rob windsor mentions in answer, i've got many of sharepoint web services wrapped jquery create them easier utilize in spservices jquery library. i'd suggest seek out, won't have much work.
javascript jquery soap sharepoint-2010
Comments
Post a Comment