Encode and generate a response to JSONP request