Add webserve set application/json header on json output

Based on PR-778-kageurufu but
Output jQuery function as javascript