Did some cleaning up of ajax.js and fixed a bug from commit [6457].