I have to develop a page for SharePoint 2013 where I am retreving data from a list and showing it.
I have a list called Test , below is my code to retreive data from list.
function getDataValue(Oname) {
set_value();
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('test');
var CamlQuery ="<query><where><eq><fieldref name="Opportunity_x002d_Name"><value type="Text">"+Oname+"</value></fieldref></eq></where></query>";
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("<view>"+CamlQuery+"</view>");
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded(sender, args) {
var value = '';
var sum=0;
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
value= oListItem.get_item("Opportunity_x002d_Name");
// alert(value);
ID=oListItem.get_item("ID");
// alert(ID);
getBALData(oListItem);
getPMData(oListItem);
total();
//Totalsum=Totalsum+parseInt(value);
}
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
The error I am getting is
Request failed unexpected response data from server.
null
What might be the cause for this?