implemented ajax and fixed card type variable