Commit ce6d6739 authored by astaxie's avatar astaxie Committed by GitHub

Merge pull request #2045 from Maxgis/master

avoid  error when the  callback function not exisit
parents c2aeab78 8099a81b
......@@ -212,7 +212,8 @@ func (output *BeegoOutput) JSONP(data interface{}, hasIndent bool) error {
if callback == "" {
return errors.New(`"callback" parameter required`)
}
callbackContent := bytes.NewBufferString(" " + template.JSEscapeString(callback))
callback = template.JSEscapeString(callback)
callbackContent := bytes.NewBufferString(" if(window." + callback + ")" + callback)
callbackContent.WriteString("(")
callbackContent.Write(content)
callbackContent.WriteString(");\r\n")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment