put getweight from index to js