How would i get my cursor to change to this loading icon when a function is ca
You don't need JavaScript for this. You can change the cursor to anything you want using CSS :
selector { cursor: url(myimage.jpg), auto; }
See here for browser support as there are some subtle differences depending on browser