Hi
i am trying to create a autosuggest box which take data from my apacge
solr server which is going to be in another domain for production
i just simply need to request a query with the address
"http://localhost:8080/solr/select?q=ABC&callback=handleJsonResponse
i can get JSON as a result or an XML as a result
i followed th steps from the developers page tutorials;
it says give a parameter with a name of callback and set the callback
func.name ;
and according to the tutorial it shows that the response has to be some
thing like GivenCallBackName([ JsonResults ])
Unfortunetly when i try to do this i got a reponse with the request
parameters inside it when i do this manuelly from the iexplorer,
when i do this from gwt i get NULL as a returning result
i got the code down below, wat should i do ?
request syntax :
getJson(UNIQUE_ID_FOR_JS,
"http://localhost:8080/solr/select?q=TUR&callback=handleJsonResponse&wt=json"_URL,
this);
public native static void getJson(int requestId, String url,
ProTravel handler) /*-{
var callback = "callback" + requestId;
// [1] Create a script element.
var script = document.createElement("script");
script.setAttribute("src", url+callback);
script.setAttribute("type", "text/javascript");
// [2] Define the callback function on the window object.
window[callback] = function(jsonObj) {
// [3]
[email protected]::handleJsonResponse(Lcom/google/gwt/core/client/JavaScriptObject;)(jsonObj);
window[callback + "done"] = true;
}
// [4] JSON download has 1-second timeout.
setTimeout(function() {
if (!window[callback + "done"]) {
[email protected]::handleJsonResponse(Lcom/google/gwt/core/client/JavaScriptObject;)(null);
}
// [5] Cleanup. Remove script and callback elements.
document.body.removeChild(script);
delete window[callback];
delete window[callback + "done"];
}, 1000);
// [6] Attach the script element to the document body.
document.body.appendChild(script);
}-*/;
/**
* Handle the response to the request for stock data from a remote
server.
*/
public void handleJsonResponse(JavaScriptObject jso) {
// this is the callback
}
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/l6BhUdSJeIEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.