捕获AJAX呼叫

I am developing a Firefox add-on. It basically parses the HTML document after it loads in the browser. I am able to capture events like form submission, link clicked etc. However when a HTML pages silently submits via an AJAX call and partially gets updated, I am unable to capture them - hence as such how can I trap a web page AJAX request / response in an add-on?

While you can try detecting the AJAX call - what you really want to detect are page modifications it seems. You can use mutation observers (introduced in Firefox 14) for that. For example:

var observer = new MutationObserver(onDocumentChange);

// We are interested in elements being added/removed and text changes, not in
// attribute changes however.
var config = { attributes: false, childList: true,
               characterData: true, subtree: true };

// Start observing the content page's document
var doc = gBrowser.contentWindow.document;
observer.observe(doc, config);

The function onDocumentChange will be called whenever changes are made to the content document.