Adapted Advert.java to ajax requests