Hi All,

I have a jsp which displays a list read from database. In database, status field is dynamically updated by background thread. I want to display the changed status without refreshing page. So, I am using AJAX. I want to make AJAX request conditionally. I mean if all the statuses on the page are complete, then I don't want to make AJAX call, because there is nothing to update. I want to make AJAX call only if I have status other than complete. From my servlet, I set a flag in a request attribute as true or false dependng on status. In a JSP I get request attribute assign it a js variable. If it's true make AJAX call and I call that function on body onload. It works fine for the first time. But js variable never gets updated even though sevlet updates flag value. How do I address this issue? Calling function on onload will not work.

Any help is appreciated.

Thanks,