cleaned up ajax and post method