mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
- added ?callback= parameter for JsonP support
- this is needed for json ajax cross domain calls - see: http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/ git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5674 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
d84264946b
commit
4f3bdc64b5
|
@ -126,7 +126,17 @@ public class yacysearch {
|
|||
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
||||
// 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", "");
|
||||
}
|
||||
|
||||
// collect search attributes
|
||||
boolean newsearch = post.hasValue("query") && post.hasValue("former") && !post.get("query","").equalsIgnoreCase(post.get("former","")); //new search term
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#[jsonp-start]#
|
||||
{
|
||||
"xmlns$yacy": "http://www.yacy.net/",
|
||||
"xmlns$os": "http://a9.com/-/spec/opensearch/1.1/",
|
||||
|
@ -22,4 +23,5 @@
|
|||
],
|
||||
<!--#include virtual="yacysearchtrailer.json?eventID=#[eventID]#" -->
|
||||
}]
|
||||
}
|
||||
}
|
||||
#[jsonp-end]#
|
Loading…
Reference in New Issue
Block a user