public native static void getJson(int requestId, String url,
MyApplication handler) /*-{
var callback = "callback" + requestId;
var script = document.createElement("script");
script.setAttribute("src", url+callback);
script.setAttribute("type", "text/javascript");
window[callback] = function(jsonObj) {
[EMAIL PROTECTED]::handleJsonResponse(Ljava/
lang/String;)(jsonObj.toJSONString());
window[callback + "done"] = true;
}
// JSON download has 1-second timeout
setTimeout(function() {
if (!window[callback + "done"]) {
[EMAIL PROTECTED]::handleJsonResponse(Ljava/
lang/String;)(null);
}
// cleanup
document.body.removeChild(script);
delete window[callback];
delete window[callback + "done"];
}, 1000);
document.body.appendChild(script);
}-*/;
public void handleJsonResponse(String jso) {
Window.alert(jso);
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
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
-~----------~----~----~----~------~----~------~--~---