Code for getting timeline data - ajax call and related model