Javascript refactor

Change gitignore to ignore output files, also made javascript dynamic and generate one request function that all the event listeners call.