Figured it out... _IG_FetchContent. David
On Jan 22, 6:45 pm, sftriman <[email protected]> wrote: > I am writing my first gadget. In my XML file, I include the JS file > search.js on my server. The main thing in the Content is just this: > > <div id="searchform"> > <form action="javascript:searchData();"> > Keywords: <input type="text" name="keywords" id="keywords"> > <input type="submit" value="Search"> > <input type="hidden" name="pagenum" id="pagenum" value="1"> > <input type="hidden" name="outputformat" id="outputformat" > value="tabular"> > </form> > </div> > <div id="output" style="display: none;"></div> > > by which I mean to execute searchData in search.js on my server, > then modify the output div block using display:block and innerHTML. > > So, this all works, more or less, as expected. > > The part I need to get working is the searchData function. In it, I > want > to dynamically get data from my site. > > I first tried AJAX, but this doesn't work. I think it's because when > I try > to create an HTTP connection, it's in my local file search.js, but > it's > coming from iGoogle, so it can't do it. > > This is my search.js file, which like I said, works insofar as it will > do alerts and I can modify the innerHTML statically: > > function searchData(startpage) { > // alert('search'); > // document.getElementById("output").style.display = "none"; > > var st=document.getElementById("keywords").value; > // alert('st='+st); > > // document.write("<scr"+"ipt language='javascript' > src='http://www.myserver.com/cgi-bin/igoogle-search.cgi?st="+st+"'>"+"</scr"+"ipt>"); > > document.getElementById("output").style.display = "block"; > document.getElementById("output").innerHTML = 'testing'; > // alert('zz'); > > gadgets.window.adjustHeight(); > } > > The document.write actually "works" in that it will render the content > in iGoogle in the designated space, but then my searchbox goes away > as the write just ignores all the divs. I tried to make it so that > the write > would even write the searchbox again and reference search.js, but that > didn't work. And that just seems wrong. > > What I really want to do is to invoke a CGI on my server, written in > perl, > which will return the data, and then I'd just update the innerHTML to > be > that content. So something like: > > http://www.myserver.com/cgi-bin/igoogle-search.cgi?st=tiger > > would exist, and would return... well, I'm not sure. JS? XML? > Plain text / HTML? Ideally just HTML which I'd pop into the output > div container. > > So how do I do this? Could I use AJAX? If not, does anyone have > an example that works? > > I'd appreciate the help! Thanks! > > David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "iGoogle Developer Forum" 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-Gadgets-API?hl=en -~----------~----~----~----~------~----~------~--~---
