Watching Ajax Requests

42 views
Skip to first unread message

jheddings

unread,
Aug 24, 2009, 11:53:24 PM8/24/09
to greasemonkey-users
I am trying to write a script to tweak Mint.com's transaction screen.
They are using lots of Ajax to load transactions asynchronously. Is
there an easy way to detect when an Ajax request completes?

What I'm ultimately trying to do is change the format of each
transaction on the page, based on some rules. In order to do this, I
think I need to iterate over each visible transaction, match it
against my rules, and apply the formatting to the row. Any pointers
on doing this effectively? I'm a bit new to Greasemonkey development,
but I'm very comfortable programming in JS.

David S.

unread,
Aug 25, 2009, 12:25:47 AM8/25/09
to greasemonkey-users
There are people here. Lurking.. I'm watching closely. Am interested
in learning, but I'm no JS expert (yet). Just didn't want you to think
no-one was here.

David

Anthony Lieuallen

unread,
Aug 25, 2009, 1:45:46 PM8/25/09
to greasemon...@googlegroups.com
On 08/24/09 23:53, jheddings wrote:
> .. Is there an easy way to detect when an Ajax request completes? ..
What I'm ultimately trying to do is change the format of each
transaction on the page..

What you'll probably want is the DOMNodeInserted event [1]. This is how
I, for example, insert favicon into Google Reader entries [2]. If your
page has some transactions "in" the page, and some added later by AJAX,
it should be a simple matter to handle each, individually, by a helper
function: grab each element in the page, when the script runs, for
processing, and then handle each new one as it is added.

[1]
http://www.w3.org/TR/DOM-Level-3-Events/events.html#event-DOMNodeInserted
[2]
http://arantius.com/misc/greasemonkey/google-reader-entry-faviconizer.user.js

Reply all
Reply to author
Forward
0 new messages