Functioning javascript for dashboard load