Making use of some jQuery chaining
Added mysql errormessage on fail