Added getData javascript function