added .asJSON() and fixed 2 bugs w.r.t. the submit button
polishing the JS code and completing (non-JSdoc) documentation