Sunday, April 1, 2012

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

The docs (https://developers.google.com/maps/documentation/places/) say nothing about that they support JSONP requests. Instead just below the table of contents they say: 

Looking to use this service in a JavaScript application? Check out the 
Places Library of the Google Maps API v3.

So you probably want to checkout their JavaScript Places API: 

https://developers.google.com/maps/documentation/javascript/places

-- J.


Am Sonntag, 1. April 2012 04:40:26 UTC+2 schrieb Alex Luya:
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 view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/hjzwgJvH-5IJ.
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