moved ajax call to bg