Skip to content

Tag: javascript

Save click co-ordinates to a file on the server

I am currently outputting the user click co-ordinates to the console and saving the file manually. I am trying to output these coordinates to a json file on the server which will be updated every time the user clicks. However I am not managing to do so with my current code. Answer There are quite a few things…

Javascript generate unique number based on string

Lets say I have a string var input = “Foo” and I need a 100% unique number from that string, I tried something like But this generates duplicates like W8M and YSM and both return the id of 149. Is there an algorithm for something like this? Answer You want a hash function. Hash functions are gener…

How to catch form submit with Backbone.js

When I test and click my apply button after I put in data in my input fields, I get a file not found error. The Login button is a dummy button with no functionality to it. I want to only display an alert box that says “You logged in as (user name here) Succesfully!!!” after apply is clicked. Answe…