primary coding with ajax request