ajaxrequest in own function