diff --git a/htroot/suggest.java b/htroot/suggest.java index 441505299..552b0e601 100644 --- a/htroot/suggest.java +++ b/htroot/suggest.java @@ -102,6 +102,16 @@ public class suggest { prop.putHTML("query", originalquerystring); } + // check for JSONP + if ( post.containsKey("callback") ) { + final String jsonp = post.get("callback") + "(["; + prop.put("jsonp-start", jsonp); + prop.put("jsonp-end", "])"); + } else { + prop.put("jsonp-start", ""); + prop.put("jsonp-end", ""); + } + // Adding CORS Access header for xml output if (xml) { final ResponseHeader outgoingHeader = new ResponseHeader(200); diff --git a/htroot/suggest.json b/htroot/suggest.json index fab9e4743..222c110c3 100644 --- a/htroot/suggest.json +++ b/htroot/suggest.json @@ -1 +1 @@ -["#[query]#",[#{suggestions}#"#[text]#"#(eol)#,::#(/eol)##{/suggestions}#]] +#[jsonp-start]#["#[query]#",[#{suggestions}#"#[text]#"#(eol)#,::#(/eol)##{/suggestions}#]]#[jsonp-end]# \ No newline at end of file