| From | Sent On | Attachments |
|---|---|---|
| Kevin | Sep 22, 2010 1:57 pm | |
| Kevin | Sep 23, 2010 5:14 am | |
| Rob Russell | Sep 28, 2010 1:36 pm | |
| Kevin | Sep 29, 2010 1:08 pm | |
| Kevin | Oct 1, 2010 5:00 am | |
| Rob Russell | Oct 1, 2010 3:07 pm | |
| Kevin | Oct 6, 2010 12:24 pm |
| Subject: | [iGoogle Developer Forum] Re: gadgets.io is undefined | |
|---|---|---|
| From: | Kevin (kevi...@solers.com) | |
| Date: | Sep 29, 2010 1:08:18 pm | |
| List: | com.googlegroups.google-gadgets-api | |
I've figured out how to get my gadget into an iGoogle page by adding it via the "My Gadgets" gadget and it gets past the gadgets.io methods (but not in the GGE Preview pane). It now fails in the gadgets.io.makeRequest() callback function when I try to access the makeRequest argument. The error just says "undefined" when I try to do something with obj.data in the following code. Any suggestions?
<?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="Tester, the Gadget" title_url="http://www.fundalarm.com/" description="Simple gadget to look up mutual fund data on fundAlarm" author="Kevin" /> <Content type="html"><![CDATA[ <script type="text/javascript">
function makeDOMRequest() { var url = "http://www.fundalarm.com/fund.asp"; var params = []; var userdata = {"ticker1" : document.getElementsByName("ticker1") [0].value}; try { var postdata = gadgets.io.encodeValues(userdata); alert("Submitted: "+postdata); params[gadgets.io.RequestParameters.POST_DATA]= postdata; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM; params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST; gadgets.io.makeRequest(url, response, params); } catch(err) { alert("makeDOMrequest(): "+err.name+": "+err.message); } }
function response(obj) { alert("In response()"); try { alert("About to try obj.data..."); var funddata = obj.data; alert(funddata); var tabledata = obj.data.getElementsByTagName("table"); var fundname = tabledata[1].rows[0].cells[0].innerHTML; alert("Fund: "+fundname); document.write("<br/><b>Fund: </b>", fundname, "<br/>"); //add more code when this is working... } catch(err) { alert("response(): "+err.name+": "+err.message); } } </script>
<div> <CENTER>Enter a mutual fund symbol:<br/> <input type="text" maxlength=5 size=6 name="ticker1" /> <input type="button" value="Go" onclick="makeDOMRequest();" /> </CENTER> </div> <p>Testing xxx...</p> ]]></Content> </Module>
Kevin
On Sep 28, 4:37 pm, Rob Russell <robr...@google.com> wrote:
I've seen similar problems when the Javascript starts to run before all resources are finished loading. Try starting your Javascript from an onload handler.
Rob Russell Google Developer Relations
On Thu, Sep 23, 2010 at 5:14 AM, Kevin <kevi...@solers.com> wrote:
More details: The HTML renders OK in the GGE Preview pane. The javascript error occurs when I click a button that calls a javascript function that uses several gadgets.io methods and fields.
One other question about GGE: the preview tab puts all the html in a small dashed-line box that significantly restricts the real estate. What is up with that? I can't seem to adjust it by setting the modulePrefs height and width.
On Sep 22, 4:58 pm, Kevin <kevi...@solers.com> wrote:
Trying to create my first gadget using Google Gadget Editor in FF 3.6.8. Tried to use the gadgets.io.makeRequest() method per the Gadgets API Reference (http://code.google.com/apis/gadgets/docs/ reference/) and the error console only says "gadgets.io is undefined". No other errors. What am I doing wrong?
-- You received this message because you are subscribed to the Google Groups "iGoogle Developer Forum" group. To post to this group, send email to Goog...@googlegroups.com. To unsubscribe from this group, send email to Google-Gadgets-API+unsu...@googlegroups.com<Goog...@googlegroups.com> . For more options, visit this group at http://groups.google.com/group/Google-Gadgets-API?hl=en.
--
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" group.
To post to this group, send email to Goog...@googlegroups.com.
To unsubscribe from this group, send email to
Google-Gadgets-API+unsu...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/Google-Gadgets-API?hl=en.





