I get a 400 bad request with this ajax call, i tryied the caml query with caml designer and it should work. What is the problem?
var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://ift.tt/sVJIaE'>";
soapEnv += " <soapenv:Body>";
soapEnv += " <GetListItems xmlns='http://ift.tt/rrg8m0'>";
soapEnv += " <listName>PollUserData</listName>";
soapEnv += " <query>";
soapEnv += " <Query>";
soapEnv += " <OrderBy Override='TRUE'>";
soapEnv += " <FieldRef Name='Created' Ascending='FALSE' />";
soapEnv += " </OrderBy>";
soapEnv += " <Where>";
soapEnv += " <And>";
soapEnv += " <Eq>";
soapEnv += " <FieldRef Name='UserID' />"
soapEnv += " <Value Type='Text'>" + userGuid + "</Value>";
soapEnv += " </Eq>";
soapEnv += " <Eq>";
soapEnv += " <FieldRef Name='QuestionID' />"
soapEnv += " <Value Type='Text'>" + allQuestionsArray[i].ID + "</Value>";
soapEnv += " </Eq>";
soapEnv += " </And>";*/
soapEnv += " </Where>";
soapEnv += " </Query>";
soapEnv += " </query>";
soapEnv += " </viewFields>";
soapEnv += " <ViewFields>";
soapEnv += " <FieldRef Name='UserID'/>";
soapEnv += " <FieldRef Name='QuestionID'/>";
soapEnv += " <FieldRef Name='Question'/>";
soapEnv += " <FieldRef Name='Answer'/>";
soapEnv += " </ViewFields>";
soapEnv += " </viewFields>";
soapEnv += " </GetListItems>";
soapEnv += " </soapenv:Body>";
soapEnv += " </soapenv:Envelope>";
var port = window.location.port;
if (port.length <= 0)
port = "";
else
port = ":" + port;
var webservice = _spPageContextInfo.webAbsoluteUrl + "/_vti_bin/lists.asmx";
$.ajax({
url: webservice,
type: "POST",
dataType: "xml",
data: soapEnv,
async: false,
contentType: "text/xml; charset=\"utf-8\"",
complete: function (xData, status) {
$(xData.responseXML).find("z\\:row, row").each(function () {
})
}, error: function(xhr){
}
});
0 commentaires:
Enregistrer un commentaire