FIX Ajax API doesn't load in correct order

At the moment, the Recaptcha JS file is loaded at the end of the <body> using requirements, but the inline script that depends on it is injected to the template immediately.

This injects the inline script after the external file so that the dependence is ready

This looks like a problem in all the branches so should be merged into all of them