added ajax loader and fixed file variable issue in js