moving ajax code