seperate view and javascript