HTML table not referencing a sharepoint list correctly

Multi tool use
Multi tool use


HTML table not referencing a sharepoint list correctly



I am trying to pull data from a Sharepoint list into individual HTML tables. I have created a connection through Javascript for each individual table, however, it doesn't seem to bring the data into the table.



I run the below code about 10 times to link to the different table headers.





$(document).ready(function() {
var myQuery =
"" +
"Bristol Water"+
"" +
"" +
"" +
"";
$().SPServices({
webURL: "https://ext.kier.group/teams/Utilities/",
operation: "GetListItems",
async: false,
listName: "UtilitiesContracts",
CAMLQuery: myQuery,
CAMLRowLimit: 100,
completefunc: function(xData, Status) {
var liHtml = "";
$(xData.responseXML).SPFilterNode("z:row").each(function() {
liHtml = liHtml + " " + $(this).attr("ows_Client") + "" + $(this).attr("ows_ContractName")+ "" + $(this).attr("ows_ContractDescription")+ "" + $(this).attr("ows_OperationalContacts")+ ""$(this).attr("ows_CommercialContacts")+ "";
});
liHtml += "";
$("#BristolTable").append(liHtml);
}
});
$('#BristolTable').DataTable({
"dom": 'Rlfrtip'
});
});





Are you receiving any errors in the console? Have you printed the xData to make sure it's getting populated?
– Matt
Jul 2 at 16:02




1 Answer
1



You missing a "+" in the code above.



The full code below for your reference:


<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/dataTables.jqueryui.min.css">
https://code.jquery.com/jquery-1.12.4.min.js
https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js
https://www.datatables.net/release-datatables/extensions/ColReorder/js/dataTables.colReorder.js
<!--SPServices Javascript-->
https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-2014.02.min.js
<!--SpServices JavaScript get items from list 'files'-->

$(document).ready(function() {
var myQuery =
"" +
"Bristol Water"+
"" +
"" +
"" +
"";
$().SPServices({
webURL: "https://ext.kier.group/teams/Utilities/",
operation: "GetListItems",
async: false,
listName: "UtilitiesContracts",
CAMLQuery: myQuery,
CAMLRowLimit: 100,
completefunc: function(xData, Status) {
var liHtml = "";
$(xData.responseXML).SPFilterNode("z:row").each(function() {
liHtml = liHtml + " " + $(this).attr("ows_Client") + "" + $(this).attr("ows_ContractName")+ "" + $(this).attr("ows_ContractDescription")+ "" + $(this).attr("ows_OperationalContacts")+ ""+$(this).attr("ows_CommercialContacts")+ "";
});
liHtml += "";
$("#ContractsTable").append(liHtml);
}
});
$('#ContractsTable').DataTable({
"dom": 'Rlfrtip'
});
});

<table id="ContractsTable" class="display" cellspacing="0">
<thead>
<tr>
<th>Client</th>
<th>Contact Name</th>
<th>Contact Description</th>
<th>Operational Contacts</th>
<th>Commercial Contacts</th>
</tr>
</thead>
</table>






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

9D1tBm,RDlU7f,Jk5ppTNacPA7 iyMFMj20n6,PSb ue DPbO8chl wP m,QWv06AbV7Ry,0jF6I TGGx7 7CD6,aqGCEjNcNdAd
74gRz1Xb2G4I yvO7S8LPSnw,UEa8aq

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications