String url3 = "https://ajax.googleapis.com/ajax/services/search/news?v=1.0&q=barack%20obama"; JsonpRequestBuilder jsonp = new JsonpRequestBuilder(); //jsonp.setCallbackParam("callback"); //gwt will generate a java script object of url "http://url_of_some_service?para=value%callback=_xxxx_onSuccess" //the _xxxx_onSuccess points to below onSucess function. jsonp.requestObject(url3, new AsyncCallback<javascriptobject>() { public void onFailure(Throwable throwable) { GWT.log("got the JavaScriptObject"); Window.alert("jsonp failed"); } public void onSuccess(JavaScriptObject feed) { JSONObject obj = new JSONObject(feed); JSONValue val = obj.get("responseStatus"); if(val != null) { JSONNumber num = val.isNumber(); Window.alert("got the responseStatus " + num.doubleValue()); } else { Window.alert("not getting the responseData"); } } });
2011/07/07
How to make JSONP call in GWT
Example goes here:
Subscribe to:
Post Comments (Atom)
Post Code on Blogger
Simplest way to post code to blogger for me: <pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black;overflow-x:...
-
Explain There is not interrupt PIN for PCIe interrupt. When device wants to raise an interrupt, an interrupt message is sent to host via ...
-
Configure Space Addressing One of the major improvements the PCI Local Bus had over other I/O architectures was its configuration mechanism...
-
What is LMA and VMA Every loadable or allocatable output section has two addresses. The first is the VMA, or virtual memory address. This ...
No comments:
Post a Comment