debugged php and js.

Will print success if called before check
fixed ajax display error issue

php mysqli is cauding problems. most functions are deprecated.