fix returncode checks form input

The javascript code has been updated with latest jquery methods and is
somewhat cleaner and more readable. There might be however still be some
work to do.