adjusted js for ajax