use application/json instead of text/plain when returning a json in script tags