Saturday, March 31, 2012

call google places service error:invalid label:“html_attributions”

This question has been asked here(and several other places): google
places api error with jquery ajax call... html_attributions same as his
case,I can see response coming back fine in firbug's json tab,and
difference is I do add "callback",but still I got this error,this is my
code:

public native static void getJson(int requestId, AroundInfoHandler
handler) /*-{
var callback = "callback" + requestId;
// [1] Create a script element.
var script = document.createElement("script");
script.setAttribute("src",
"https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=myKey"+callback);
script.setAttribute("type", "text/javascript");

// [2] Define the callback function on the window object.
window[callback] = function(jsonObj) {
// [3]
console.log("Succeed to call google places service");
console.log(jsonObj);
//call java method here
window[callback + "done"] = true;
}

// [4] JSON download has 1-second timeout.
setTimeout(function() {
if (!window[callback + "done"]) {
console.log("Failed to call google places service");
//call java method here;
}

// [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);
}-*/;
Even change window/document to $wnd/$doc,same problem as before,Can
anybody help me?Thanks!

--
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