Fix for: HTTP basic auth username/password not passed into jQuery.ajax() call

Fix and tidy up the code
I was under the impression it worked until I noticed, that the username/password entered manually got cached in the browser session.
Now tested with and without password in latest Chrome and work alright.