mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 00:30:56 +00:00
Merge pull request #2045 from Maxgis/master
avoid error when the callback function not exisit
This commit is contained in:
commit
ce6d673933
@ -212,7 +212,8 @@ func (output *BeegoOutput) JSONP(data interface{}, hasIndent bool) error {
|
|||||||
if callback == "" {
|
if callback == "" {
|
||||||
return errors.New(`"callback" parameter required`)
|
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.WriteString("(")
|
||||||
callbackContent.Write(content)
|
callbackContent.Write(content)
|
||||||
callbackContent.WriteString(");\r\n")
|
callbackContent.WriteString(");\r\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user