Query SharePoint List Items Using Jquery

I have created the following Script to show SharePoint List Items Using JQuery. This example uses SharePoint’s Lists.asmx web service to retrieve all the list items of a specific list in a plain Content Editor Web Part.

/sites/demojoseph/Shared%20Documents/jquery-1.4.2.min.js

$(document).ready(function() {
var soapEnv =
” \
\
\
Group Testing \
\
\
\
\
\
\
\
“;

$.ajax({
url: “/sites/demojoseph/_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() {
var liHtml = “

  • ” + $(this).attr(“ows_Title”) + “
  • “;
    $(“#GroupTestingItems”).append(liHtml);
    });
    }

    <ul id=”GroupTestingItems”/>

    Advertisements

    About Joseph Velliah
    As a SharePoint Developer my professional interests tend to be technical and SharePoint focused. I run a blog at "SP RIDER" where you can expect to read HOW TOs and scenarios that I run into during my day to day job. I hope my posts will give back a little to the community that is helped me.

    7 Responses to Query SharePoint List Items Using Jquery

    1. Brian says:

      Hi Joseph! I like the quote. Quick question for you. The query that you created, does it work across site collection?

    2. Baz says:

      Hi Brian,, can you please tell me how to update the value of a choice item? This is the code I am trying.

      function UpdateStatus(itemId){
      alert(itemId);
      $().SPServices({
      operation:”UpdateListItems”,
      async:false,
      listName:”Hot_seat”,
      ID:”007″,
      valuepairs:[[“Status”, “Occupied”],[“Occupancy hours”,”2″]],
      completefunc: function (xData, Status)
      {alert(“Update Done”);}
      });
      }

      I am trying to update the item ID number 007 the values I want to change are Status to Occupied from available and Occupancy hours to 2 Hours. The above code throws error as “OBJECT DOESN’T SUPPORT THIS PROPERTY OR METHOD”
      can you please help?

    3. Pingback: using JQuery and Web Services to display a list on Content Editor

      • Mr User,

        Its not required for me to take the code from the link you had mentioned. If you search with the same keyword you will get thousands of pages in Google. Do you really think everyone is copying the code from this link.

        Think and then speak.

    4. Thank you so much for helping me!

    Leave a Reply

    Please log in using one of these methods to post your comment:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s

    %d bloggers like this: