$.ajax.support.cors = true; //enable CORS support, default is true in v1.9+
var listName = "Your List Name".replace(/\s/g, ''); //no white spaces
var filter = encodeURI("?$filter=Title eq 'some title'");
$.ajax({
url: "http://yoursharepointsite.com/_vti_bin/listdata.svc/" + listName + filter,
method: "GET",
type: "POST",
cache: false,
contentType: "application"text/json;xml; charset=utf-8",
username: "username",
password: "password",
dataType: "json""xml"
})
.done(function(xmlDoc, status, responseObj) {
//handle
})
.fail(function(xmlDoc, status, responseObj) {
//handle
})
.always(function() {
//handle
});
//Old fashioned Web Service - works
var listName = "yourListName";
var packet = '<?xml version="1.0" encoding="utf-8"?>'+
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+
'<soap:Body><GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/"><listName>' + listName + '</listName></GetList></soap:Body></soap:Envelope>';
$.ajax({
url: "http://yoursharepointsite.com/_vti_bin/lists.asmx",
type: "POST",
dataType: "xml",
data: packet,
contentType: "text/xml; charset='utf-8'",
headers: {
"SOAPAction": "http://schemas.microsoft.com/sharepoint/soap/GetList",
"Content-Type": "text/xml; charset=utf-8"
}
}).done(function(xDataxmlDoc, status, responseObj) {
//handle
})
.fail(function(xDataxmlDoc, status, responseObj) {
//handle
})
.always(function() {
//handle
});