js logic for send block