There are a few issues with what you are doing:
If you are on Splunk 5, you do not need xml2json, unless of course you are trying to run the unit tests.
service.login function call is missing a couple of closing parenthesis.
scheme should be https, unless you have changed the default Splunk installation.
You need to serve this page from a web server and in that web server you will need to set up the proxy. This last steps is taken care of if you run the examples through node, i.e. node sdkdo examples from the command line. This is also documented at JavaScript SDK Browser Examples.
... View more