robfig/revel — pull request #263 by andrewmunsell (2013-08-07 18:03:07+00:00)
Title: Add RenderJsonP Function

I needed a way to render a JSONP result for an API I'm building. While there's a bit of duplicated code with the new function (it could probably be condensed for the most part), I figured I'd leave it separated out for now.

The call is similar to the existing RenderJson call, but with an additional argument-- a string containing the name of the Javascript callback function.

For example--

`c.RenderJsonP("callback", someStruct)`

Would render the following with a `content-type` header of `application/javascript`.

`callback({ key: "value" })`

I also wrote a quick blurb about the function in the documentation, but I have *not* modified the godoc yet-- I'm quite new to Go and am still figuring out how to use all of the tools.