Saturday, November 2, 2013

CSOM + JQuery + JSON in SharePoint


Here is sample example to invoke Custom List using web service in Client Side object model

var lstURL = "http://site/_vti_bin/listdata.svc/web/CustList"


$(document).ready(function () {
    $.getJSON(lstURL,function (data) {
            alert("Hi There");               
        });
});

If it is REST API, the format of the URL will be different something like

var lstURL = "http://site/_api/web/lists/getbytitle('CustList')";

No comments:

Post a Comment