Adds Ajax Request to secure.js

Ports over some code from server.js to secure.js in preperation to
switch secure.js to server.js