Here is my code to fetch Announcements
List and display it as HTML table:
<script type="text/javascript" src="/Test_Library/js/jquery-1.11.3.js"></script>
<script type="text/javascript" src="/Test_Library/js/jquery.SPServices-0.7.1a.min.js"></script>
<div id="Announcements"></div>
<SCRIPT type=text/javascript>
$(document).ready(function() {
//alert("called");
//alert($().SPServices.SPGetCurrentSite());
var list = "Announcements";
var fieldsToRead = "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Dream_x0020_Destination' /><FieldRef Name='PPP' /></ViewFields>";
//var query = "<Query>" + "<Where>" + "<Or>" + "<Or>" + "<Eq>" + "<FieldRef Name='Title'/><Value Type='Text'>The America</Value>" + "</Eq>" + "<Eq>" + "<FieldRef Name='Dream_x0020_Destination' /><Value Type='Text'>USA</Value>" + "</Eq>" + "</Or>" + "<IsNotNull>" + "<FieldRef Name='PPP'/>" + "</IsNotNull>" + "</Or>" + "</Where>" + "<OrderBy>" + "<FieldRef Name='PPP' Ascending='False'/>" + "</OrderBy>" + "</Query>";
var query="<Query></Query>";
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Announcements",
CAMLViewFields: fieldsToRead,
CAMLQuery: query,
completefunc: function(xData, Status)
{
$(xData.responseXML).find("z\\:row, row").each(function ()
{
//alert(xData.responseXML);
var _Title = $(this).attr("ows_Title");
//alert(_Title);
var _Dream_x0020_Destination = $(this).attr("ows_Dream_x0020_Destination");
var _PPP = $(this).attr("ows_PPP");
$("#Announcements").append("<tr align='middle'>" + "<td align='left'>"+_Title+"</td>" + "<td align='left'>"+_Dream_x0020_Destination+"</td>" +"<td align='left'>"+_PPP+"</td>" + "</tr>");
});
}
});
});
I am trying to display this list inside a div
tag. I tried writing the script part within the head tag as well as body tag. However, it is not getting displayed and throwing an error
"Uncaught ReferenceError: ExecuteOrDelayUntilScriptLoaded is not defined".
Any help will be highly appreciated.