Let's JAM!

The Kynetx watchDOM Function

Working with AJAX pages on other peoples web sites can be a pain. Especially when using and creating Kynetx applications which can run on a plethora of web sites. When designing things for AJAX pages there is an "undocumented" javascript function which we use. It's name is watchDOM. It resides within the KOBJ object and has the function signature "KOBJ.watchDOM(selector,callback);". This function monitors a DOM element which you specify for changes. When it detects a change, it then runs a callback function.


To use this function, at this current time, you need emit javascript. The KOBJ.watchDOM function takes two arguments. The first is the jQuery Selector of the DOM element to be watched. The DOM element has to have children which get replaced on an AJAX change. The second argument is the function to be run when the element changes. Here's an example


KOBJ.watchDOM("#rso",function(){ $K("#content").before("This is an example of KOBJ.watchDOM"); });


Keep in mind that the uses of this function take a fairly good understanding of both AJAX as well as javascript in order to use it correctly.

If you have any questions please post them on Devex, the Kynetx help community. That way, everybody can benefit!