finally solved the js problem