to receive data from server in json format. I defined a button and
onClick for it:
public void onClick(ClickEvent event) {
Window.alert("Let's see....");
RequestBuilder reqbuilder = new
RequestBuilder(RequestBuilder.GET,com.google.gwt.http.client.URL.encode("http://
uits-group.ru/media/search-results.js"));
try {
reqbuilder.sendRequest(null, new RequestCallback() {
public void onResponseReceived(Request request, Response
response) {
Window.alert(response.getStatusCode()+"");
}
@Override
public void onError(Request request, Throwable t) {
Window.alert("Error!");
}
}
);
} catch (RequestException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Window.alert("Exception!");
}
}
StatusCode is always 0 and getResponseText() always return nothing.
What I'm doing wrong? At the specified url adress is placed .js file
with text in json, as in example JSON with GWT package. I want to
receive the text in a .js file instead of nothing. Thanks for help.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment