The code runs correctly on the backend.
Added the javascript portion