Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Java script Client Object Model and .SPServices

$
0
0

Hi, 

What is the difference between Java script  Client Object Model and .SPServices using Jquery.

* Please help me to know how it process internally. (architecture)  

* Advantage and disadvantage. Which should be used. 

In this program, used to retrieve the lists using Client Object Model and SPService.

        this.clientContext = SP.ClientContext.get_current();
        if (this.clientContext != undefined && clientContext != null) {
            var webSite = clientContext.get_web();
            this.list = webSite.get_lists().getByTitle("MyList");
            var query = SP.CamlQuery.createAllItemsQuery();
            allItems = list.getItems(query);
            clientContext.load(allItems, 'Include(Title,Extension)');                                                          
            this.clientContext.executeQueryAsync(Function.createDelegate(this,onSuccess),Function.createDelegate(this,onFail));

        }
  $().SPServices({
            operation: "GetListItems",
            async: false,
            listName: "MyList",
            completefunc: function (xData, Status) {
                $(xData.responseXML).SPFilterNode("z:row").each(function () {
                    var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
                    $("#listDisp").append(liHtml);
                });
            }
        });

Thanks, 

Krishna


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>