Created
November 8, 2019 01:59
-
-
Save dennythecoder/1877407f042de235b13453611cde22ff to your computer and use it in GitHub Desktop.
SP 2010 Get List example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getList(name, cb){ | |
var serviceUrl = 'http://yoursite/_vti_bin/listdata.svc/'; | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', serviceUrl + name); | |
xhr.setRequestHeader('accept', 'application/json;odata=verbose'); | |
xhr.onreadystatechange = function(){ | |
if(this.readyState === 4){ | |
var obj = JSON.parse(this.response); | |
cb(obj.d.results); | |
} | |
} | |
xhr.send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment