I was having trouble implementing this on my front end but then I figured it out! It has to be on the back end for this to work.

Thanks,
Chris