Use of AJAX to retrive content from database