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”/>

    7 thoughts on “Query SharePoint List Items Using Jquery

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

      Like

    2. 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?

      Like

      1. 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.

        Like

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

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

    Google photo

    You are commenting using your Google 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 )

    Connecting to %s

    This site uses Akismet to reduce spam. Learn how your comment data is processed.