Could someone tell me why this isn't working?
$(function() {
fnWaitDialog("show");
$.getJSON(".../List/$count?$expand=AARMissionTypeValue&$filter=AARMissionTypeValue eq 'Special Events Security'", function (data) {
var d = data.d;
$.each(data.d, function (n, i) {
$("#tableBodyCount").append(i.count);
});
})
.always(function () {
// Close spinner
fnWaitDialog("hide");
});
I can't seem to get it to display in the id of my spam to show a document count. It works when you use the URL.
Edit:
I got it to return a number but it should be 6 but it returns 66...
var count = data.d.results.length;
$.each(data.d, function (n, i) {
$("#tableBodyCount").append(count);
});
I suspect $.each function prints value twice.
Do one thing alert out alert(data.d.results.length); and if you are getting 6 then $.each causing it to print twice then change ur code as per below code.
Instead of
var count = data.d.results.length;
$.each(data.d, function (n, i) {
$("#tableBodyCount").append(count);
});
try this
var count = data.d.results.length;
$("#tableBodyCount").text(count);
Test the code with uploading or deleting few more documents.