understand it, here's my calling JSON and XML, and I send my code or
parameter to the gadget:
----------------Get Parameter Gadget
XML-----------------------------------------
try{
//blip.first(ElementType.GADGET).updateElement(ImmutableMap.of("gadgetUrl",
"newvalue"));
Gadget gadget = new Gadget(gadgetUrl);
gadget.setProperty("translatedText", translation);
myBlip.append(gadget);
}catch(Exception e){
myBlip.append("erreur"+e);
//return;
}
----------------------------------------------JSON return response translate
Ajax-------------------------------
String response = null;
final JSONObject json = new JSONObject(new
JSONTokener(sb.toString()));
if (json.isNull("responseData")) {
//return json.getString("responseDetails");
return json.toString();
} else {
response =
json.getJSONObject("responseData").getString("translatedText");
return HTMLEntities.unhtmlentities(response);
}
} catch (Exception e) {
return e.toString();
}
------------------------ My Gadget TTS
-----------------------------------------------------
<![CDATA[
<script type="text/javascript">
var div = document.getElementById('content_div');
function audioText(){
var framehtml="<iframe src=\"
http://translate.google.com/translate_tts?q=";
framehtml+=escape(document.getElementById('audio').value);
framehtml+="\" </iframe>";
document.getElementById('myAudio').innerHTML=framehtml;
}
function stateUpdated() {
document.getElementById('audio').value =
wave.getState().get('translatedText');
}
function init() {
if (wave && wave.isInWaveContainer()) {
wave.setStateCallback(stateUpdated);
}
}
gadgets.util.registerOnLoadHandler(init);
</script>
<textarea id="audio"></textarea><br />
<input type=button value="Text To Speech!" id="butAudio"
onClick="audioText()">
<div id="myAudio"></div>
]]>
2010/8/25 Dwarakanath Jagadeesan <[email protected]>
>
> Hello Everyone,
> I am just into using the Google Search API programming.Is
> there a way that I can see the JSON or the XML that is obtained when I
> search for a particular query?
>
> Awaiting your reply!
>
>
> --
> Thanks and Regards,
> Dwarakanath J
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google AJAX APIs" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-ajax-search-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-ajax-search-api?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google AJAX APIs" 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-ajax-search-api?hl=en.