I am working on a simple PHP application using CouchDB and PHP-on-Couch to access some views, and it works great. The next step is to introduce Ajax to update the interface with data from the database.
As far as I understand, you can use _changes alerts to detect any changes made to the database quite easily. So, this is a question of monitoring index.html for changes (through a long poll), which calls loadView.php to update the contents of the page.
First of all, I hope this is the right way around this ...
Secondly , when viewed on index.html, the page never seems to load completely (the page loading bar never ends). When a change occurs, Firebug displays the results as expected, but not subsequent changes. At this time, the page seems to have stopped the endless loading.
So far I am using jQuery to call Ajax ...
$.getJSON('http://localhost:5984/db?callback=?', function(db) {
console.log(db.update_seq);
$.getJSON('http://localhost:5984/db/_changes?since='+db.update_seq+'&feed=continuous&callback=?', function(changes) {
console.log(changes);
});
});
Any ideas what could happen here?
source
share