$.get("/static/pgpkey", function (key) { // store key // hook to submit button click event & encrypt before submit });