I need to use a php function inside this script which converts the ID into a required format.
function onlineStatus() {
$.getJSON('updateusers.php', function(data) {
$('#users').html('');
$.each(data, function(i, item) {
$('#users').append('[<span>'+ item.userid +'</span>]');
});
});
setTimeout("onlineStatus()",30000);
}
I have tried the following in various ways but I either get nothing or it fails with a missing ) after the argument list.
$('#users').append('[<span>'<?php nameFormat('+ item.userid +') ?>'</span>]');
I would appreciate your assistance.