Something you might want to consider is Server Sent Events (SSE's)
This is an HTML5 technology whereby Javascript will "long-poll" a server endpoint (your PHP file) to see if any changes have occurred. Long-polling is basically where JS (I'm not sure if it uses Ajax or another technology) sends a request every second to the endpoint
You can try it like this:
#/your_js
var evtSource = new EventSource("increment.php");
evtSource.onmessage = function(e) {
$('#hidden').val(e.data);
}
To send the data, you can make an ajax call which will send the updated JSON object to the server, like you have:
$(document).on("click", ".your_object", function(data) {
$.ajax({
type: 'POST',
url: 'increment.php',
data: $(this).serialize(),
dataType: 'json'
});
});
This will only open an Ajax request when you perform an event, and your app will be "listening" for the response every second. As you are aware, Ajax long-polling is super resource-intensive, so it will be better to look at web-socket stuff if you want true "real-time" technology, but either way, this will be a much more efficient system than just using plain ajax for everything
A caveat here -- you'll have to change your increment.php
to handle the different response types