Converted the jQuery ajax call to a plain javascript one.

A couple of other debug notices fixed.