login(username,password,next,success,failure)

Login to server using Ajax

Parameters:

- username | username to login with, default is to read it using getfield("username")

- password | password to login with, default is to read it using getfield("password")

- next | where to go next on success. Default is reload page.

- success | function to call on success

- failure | function to call on failure

The function definition used on success and failure is: funcsuccess/failure(jdata,status,xhr,who,next)

Parameters given to success and failure are

- jdata | the json returned, null on fail in call to server but fail when not ok will return json

- status | jquery status

- xhr | jquery xhr

- who | should be logout on this

- next | the next parameter given to the logout function