As you can see, I’m partial to using dojo for ajaxy stuff. All that is happening here is the base and new text is being POSTed to a Python server-side process (we like pylons, but you could just as easily use a simple Python script as a cgi). That process then needs to diff the provided text using an instance of Python’s difflib.SequenceMatcher class, and return the opcodes from that SequenceMatcher instance to the browser (in this case, using JSON serialization). In the interest of completeness, here’s the controller action from our pylons application that does this (don’t try to match up the parameters shown below with the POST parameters shown in the Javascript function above; the latter is only here as an example):